mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-05-08 09:18:39 +01:00
Add null check to pin message import.
This commit is contained in:
committed by
jeffrey-signal
parent
bef4bb40ca
commit
bd89c7fc39
+5
-2
@@ -362,12 +362,13 @@ class ChatItemArchiveImporter(
|
|||||||
} else if (pinMessage != null) {
|
} else if (pinMessage != null) {
|
||||||
followUps += { pinUpdateMessageId ->
|
followUps += { pinUpdateMessageId ->
|
||||||
val targetAuthorId = importState.remoteToLocalRecipientId[pinMessage.authorId]
|
val targetAuthorId = importState.remoteToLocalRecipientId[pinMessage.authorId]
|
||||||
if (targetAuthorId != null) {
|
val targetAuthorAci = targetAuthorId?.let { recipients.getRecord(it).aci }
|
||||||
|
if (targetAuthorId != null && targetAuthorAci != null) {
|
||||||
val pinnedMessageId = SignalDatabase.messages.getMessageFor(pinMessage.targetSentTimestamp, targetAuthorId)?.id ?: -1
|
val pinnedMessageId = SignalDatabase.messages.getMessageFor(pinMessage.targetSentTimestamp, targetAuthorId)?.id ?: -1
|
||||||
val messageExtras = MessageExtras(
|
val messageExtras = MessageExtras(
|
||||||
pinnedMessage = PinnedMessage(
|
pinnedMessage = PinnedMessage(
|
||||||
pinnedMessageId = pinnedMessageId,
|
pinnedMessageId = pinnedMessageId,
|
||||||
targetAuthorAci = recipients.getRecord(targetAuthorId).aci!!.toByteString(),
|
targetAuthorAci = targetAuthorAci.toByteString(),
|
||||||
targetTimestamp = pinMessage.targetSentTimestamp
|
targetTimestamp = pinMessage.targetSentTimestamp
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -383,6 +384,8 @@ class ChatItemArchiveImporter(
|
|||||||
.where("${MessageTable.ID} = ?", pinnedMessageId)
|
.where("${MessageTable.ID} = ?", pinnedMessageId)
|
||||||
.run()
|
.run()
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
Log.w(TAG, "Pin message target author not found or has no ACI, skipping pin message extras.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user