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


Commits:
28c4edc4 by wurstsalat at 2024-03-24T18:30:39+01:00
fix: Catch errors when trying to store pasted image

Fixes #11787

- - - - -


1 changed file:

- gajim/gtk/message_actions_box.py


Changes:

=====================================
gajim/gtk/message_actions_box.py
=====================================
@@ -538,6 +538,7 @@ def _on_paste_clipboard(self,
             # prevent TextView from pasting the URIs as text:
             texview.stop_emission_by_name('paste-clipboard')
             return
+
         log.info('No URIs pasted')
 
         image = clipboard.wait_for_image()
@@ -548,8 +549,13 @@ def _on_paste_clipboard(self,
         temp_dir = Path(tempfile.gettempdir())
         image_path = temp_dir / f'{uuid.uuid4()}.png'
 
-        if not image.savev(str(image_path), 'png', [], []):
-            log.error('Could not process pasted image')
+        try:
+            success = image.savev(str(image_path), 'png', [], [])
+            if not success:
+                log.error('Could not process pasted image')
+                return
+        except GLib.Error as e:
+            log.error('Error while trying to store pasted image: %s', e)
             return
 
         app.window.activate_action(



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/28c4edc45ef586925859d51acc2d886392536dc9

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/28c4edc45ef586925859d51acc2d886392536dc9
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