mirror of
https://github.com/oxen-io/session-android.git
synced 2025-06-09 12:48:35 +00:00
Fix crash that may happen upon first sticker install.
This commit is contained in:
parent
936bd327bd
commit
5362e07a5c
@ -188,7 +188,7 @@ public class AttachmentDatabase extends Database {
|
|||||||
String selection = STICKER_PACK_ID + " = ?";
|
String selection = STICKER_PACK_ID + " = ?";
|
||||||
String[] args = new String[] { stickerPackId };
|
String[] args = new String[] { stickerPackId };
|
||||||
|
|
||||||
try (Cursor cursor = databaseHelper.getReadableDatabase().query(TABLE_NAME, null, selection, args, null, null, "1")) {
|
try (Cursor cursor = databaseHelper.getReadableDatabase().query(TABLE_NAME, null, selection, args, null, null, null, "1")) {
|
||||||
return cursor != null && cursor.moveToFirst();
|
return cursor != null && cursor.moveToFirst();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -563,9 +563,14 @@ public class AttachmentDatabase extends Database {
|
|||||||
* database.
|
* database.
|
||||||
*/
|
*/
|
||||||
public @Nullable Cursor getUnavailableStickerPacks() {
|
public @Nullable Cursor getUnavailableStickerPacks() {
|
||||||
String query = "SELECT DISTINCT " + STICKER_PACK_ID + ", " + STICKER_PACK_KEY + " FROM " + TABLE_NAME + " WHERE " + STICKER_PACK_ID + " NOT IN (" +
|
String query = "SELECT DISTINCT " + STICKER_PACK_ID + ", " + STICKER_PACK_KEY +
|
||||||
"SELECT DISTINCT " + StickerDatabase.PACK_ID + " FROM " + StickerDatabase.TABLE_NAME +
|
" FROM " + TABLE_NAME +
|
||||||
")";
|
" WHERE " +
|
||||||
|
STICKER_PACK_ID + " NOT NULL AND " +
|
||||||
|
STICKER_PACK_KEY + " NOT NULL AND " +
|
||||||
|
STICKER_PACK_ID + " NOT IN (" +
|
||||||
|
"SELECT DISTINCT " + StickerDatabase.PACK_ID + " FROM " + StickerDatabase.TABLE_NAME +
|
||||||
|
")";
|
||||||
|
|
||||||
return databaseHelper.getReadableDatabase().rawQuery(query, null);
|
return databaseHelper.getReadableDatabase().rawQuery(query, null);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.thoughtcrime.securesms.jobs;
|
package org.thoughtcrime.securesms.jobs;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.core.util.Preconditions;
|
||||||
|
|
||||||
import org.thoughtcrime.securesms.ApplicationContext;
|
import org.thoughtcrime.securesms.ApplicationContext;
|
||||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||||
@ -56,6 +57,10 @@ public class StickerPackDownloadJob extends BaseJob {
|
|||||||
boolean isReferencePack)
|
boolean isReferencePack)
|
||||||
{
|
{
|
||||||
super(parameters);
|
super(parameters);
|
||||||
|
|
||||||
|
Preconditions.checkNotNull(packId);
|
||||||
|
Preconditions.checkNotNull(packKey);
|
||||||
|
|
||||||
this.packId = packId;
|
this.packId = packId;
|
||||||
this.packKey = packKey;
|
this.packKey = packKey;
|
||||||
this.isReferencePack = isReferencePack;
|
this.isReferencePack = isReferencePack;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user