From d6d43840edd23d5bd99e2543c786080862d83d31 Mon Sep 17 00:00:00 2001 From: Nik Clayton Date: Tue, 26 Nov 2024 20:24:25 +0100 Subject: [PATCH] fix: Prevent NPE when adding reaction to announcement --- .../pachli/components/announcements/AnnouncementsViewModel.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/app/pachli/components/announcements/AnnouncementsViewModel.kt b/app/src/main/java/app/pachli/components/announcements/AnnouncementsViewModel.kt index 850cef468..76d56f71c 100644 --- a/app/src/main/java/app/pachli/components/announcements/AnnouncementsViewModel.kt +++ b/app/src/main/java/app/pachli/components/announcements/AnnouncementsViewModel.kt @@ -84,7 +84,7 @@ class AnnouncementsViewModel @Inject constructor( { announcementsMutable.postValue( Success( - announcements.value!!.data!!.map { announcement -> + announcements.value?.data?.map { announcement -> if (announcement.id == announcementId) { announcement.copy( reactions = if (announcement.reactions.find { reaction -> reaction.name == name } != null) {