From 0753ff85edfacd924013e2d8b917c38cad34b856 Mon Sep 17 00:00:00 2001 From: Moxie Marlinspike Date: Tue, 3 Apr 2018 08:59:19 -0700 Subject: [PATCH] Default snippet type to 0 if it's null Fixes #7551 --- .../database/helpers/SQLCipherMigrationHelper.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/org/thoughtcrime/securesms/database/helpers/SQLCipherMigrationHelper.java b/src/org/thoughtcrime/securesms/database/helpers/SQLCipherMigrationHelper.java index b1a58efedd..7d40bc53ac 100644 --- a/src/org/thoughtcrime/securesms/database/helpers/SQLCipherMigrationHelper.java +++ b/src/org/thoughtcrime/securesms/database/helpers/SQLCipherMigrationHelper.java @@ -135,9 +135,11 @@ public class SQLCipherMigrationHelper { }); copyTable("thread", legacyDb, modernDb, (row, progress) -> { + Long snippetType = row.getAsLong("snippet_type"); + if (snippetType == null) snippetType = 0L; + Pair plaintext = getPlaintextBody(legacyCipher, legacyAsymmetricCipher, - row.getAsLong("snippet_type"), - row.getAsString("snippet")); + snippetType, row.getAsString("snippet")); row.put("snippet", plaintext.second); row.put("snippet_type", plaintext.first);