diff --git a/app/src/main/java/org/thoughtcrime/securesms/database/Storage.kt b/app/src/main/java/org/thoughtcrime/securesms/database/Storage.kt index a1903cc891..67f68cb292 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/database/Storage.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/database/Storage.kt @@ -1686,12 +1686,17 @@ open class Storage( val timestamp = reaction.timestamp val localId = reaction.localId val isMms = reaction.isMms + val messageRecord = timestamp?.let{ DatabaseComponent.get(context).mmsSmsDatabase().getMessageForTimestamp(timestamp) } + + // leave if this is about a deleted messsage + if (messageRecord?.isDeleted == true) return + val messageId = if (localId != null && localId > 0 && isMms != null) { MessageId(localId, isMms) - } else if (timestamp != null && timestamp > 0) { - val messageRecord = DatabaseComponent.get(context).mmsSmsDatabase().getMessageForTimestamp(timestamp) ?: return + } else if (messageRecord != null && timestamp > 0) { MessageId(messageRecord.id, messageRecord.isMms) } else return + DatabaseComponent.get(context).reactionDatabase().addReaction( messageId, ReactionRecord(