Default snippet type to 0 if it's null

Fixes #7551
This commit is contained in:
Moxie Marlinspike 2018-04-03 08:59:19 -07:00
parent 5f7c30e840
commit 0753ff85ed

View File

@ -135,9 +135,11 @@ public class SQLCipherMigrationHelper {
}); });
copyTable("thread", legacyDb, modernDb, (row, progress) -> { copyTable("thread", legacyDb, modernDb, (row, progress) -> {
Long snippetType = row.getAsLong("snippet_type");
if (snippetType == null) snippetType = 0L;
Pair<Long, String> plaintext = getPlaintextBody(legacyCipher, legacyAsymmetricCipher, Pair<Long, String> plaintext = getPlaintextBody(legacyCipher, legacyAsymmetricCipher,
row.getAsLong("snippet_type"), snippetType, row.getAsString("snippet"));
row.getAsString("snippet"));
row.put("snippet", plaintext.second); row.put("snippet", plaintext.second);
row.put("snippet_type", plaintext.first); row.put("snippet_type", plaintext.first);