Daniel Brötzmann pushed to branch master at gajim / gajim


Commits:
6780f9f5 by wurstsalat at 2024-08-10T14:16:08+02:00
fix: MessageRowActions: Make actions more robust

Since it may happen that there is no message row associated to the 
MessageRowActions
due to switching contacts while hovering a chat (hotkeys), we need to make sure 
to
actually have a message row associated when clicking any action.

Fixes #11950

- - - - -


1 changed file:

- gajim/gtk/conversation/rows/widgets.py


Changes:

=====================================
gajim/gtk/conversation/rows/widgets.py
=====================================
@@ -236,7 +236,9 @@ def _on_hover(self, _eventbox: MessageRowActions, event: 
Gdk.EventCrossing) -> b
         return True
 
     def _on_reply_clicked(self, _button: Gtk.Button) -> None:
-        assert self._message_row is not None
+        if self._message_row is None:
+            return
+
         app.window.activate_action('reply', GLib.Variant('u', 
self._message_row.pk))
 
     def _on_quick_reaction_button_clicked(self, button: QuickReactionButton) 
-> None:
@@ -250,11 +252,15 @@ def _on_reaction_added(self, _widget: AddReactionButton, 
emoji: str) -> None:
         self._send_reaction(emoji, toggle=False)
 
     def _send_reaction(self, emoji: str, toggle: bool = True) -> None:
-        assert self._message_row is not None
+        if self._message_row is None:
+            return
+
         self._message_row.send_reaction(emoji, toggle)
 
     def _on_more_clicked(self, button: Gtk.Button) -> None:
-        assert self._message_row is not None
+        if self._message_row is None:
+            return
+
         self._menu_button_clicked = True
         self._message_row.show_chat_row_menu(self, button)
 



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/6780f9f5acb0586ae9309240dd8d8ad2b29fe2ca

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/6780f9f5acb0586ae9309240dd8d8ad2b29fe2ca
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to