Skip to content

Commit

Permalink
Fix potential crash by removing an unnecessary column.
Browse files Browse the repository at this point in the history
The column I removed is already in the recipient half of the projection.
Having two representations of the groupId made reading the groupId out
of the cursor non-deterministic, and when compounded with another bug,
could cause a crash if one of them was null.
  • Loading branch information
greyson-signal committed Jun 1, 2020
1 parent 3fec23f commit f270a6b
Showing 1 changed file with 1 addition and 2 deletions.
Expand Up @@ -760,8 +760,7 @@ private List<RecipientSettings> getRecipientSettingsForSync(@Nullable String que
List<RecipientSettings> out = new ArrayList<>();

String[] columns = ArrayUtils.concat(RECIPIENT_FULL_PROJECTION,
new String[]{ GroupDatabase.TABLE_NAME + "." + GroupDatabase.GROUP_ID,
GroupDatabase.TABLE_NAME + "." + GroupDatabase.V2_MASTER_KEY });
new String[]{GroupDatabase.TABLE_NAME + "." + GroupDatabase.V2_MASTER_KEY });

try (Cursor cursor = db.query(table, columns, query, args, null, null, null)) {
while (cursor != null && cursor.moveToNext()) {
Expand Down

0 comments on commit f270a6b

Please sign in to comment.