From b07f8f203db3338502dee7e45b80d9715aab7bbb Mon Sep 17 00:00:00 2001 From: davotoula Date: Sat, 25 Jul 2026 12:44:34 +0200 Subject: [PATCH] refactor(chats): drop redundant !! on chat-message edit callback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `if (canEditBuzz || canEditConcord)` guard already proves `onWantsToEditChatMessage` non-null — both booleans are local vals whose definitions begin with a null check, and K2 propagates that through them. The `!!` compiled to an assertion that could never fire, and produced an "Unnecessary non-null assertion" compiler warning. No behaviour change: the smart-cast invoke is what was already happening. If either guard is later loosened, this now fails at compile time instead of becoming a runtime NPE. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01WopdqNoZ9tYoMNppJG17BL --- .../ui/screen/loggedIn/chats/feed/ChatMessageActionSheet.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/ChatMessageActionSheet.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/ChatMessageActionSheet.kt index 72170071c9..263823e3e9 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/ChatMessageActionSheet.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/ChatMessageActionSheet.kt @@ -287,7 +287,7 @@ fun ChatMessageActionSheet( TileRow { val label = if (canEditBuzz) R.string.buzz_edit_message else R.string.edit_message ActionTile(MaterialSymbols.Edit, stringRes(label)) { - onWantsToEditChatMessage!!(note) + onWantsToEditChatMessage(note) onDismiss() } }