diff options
author | fiaxh <git@lightrise.org> | 2020-10-27 15:31:39 +0100 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2020-10-27 16:05:30 +0100 |
commit | 2e0357877cf3e8e391d3f8f02970defa93c710eb (patch) | |
tree | 4478a0deebbedf00934c7a7d6324180c4158bb38 /main/src/ui/conversation_view_controller.vala | |
parent | edbc8f794d42cc30bfbe6602becb43c3500e02a2 (diff) | |
download | dino-2e0357877cf3e8e391d3f8f02970defa93c710eb.tar.gz dino-2e0357877cf3e8e391d3f8f02970defa93c710eb.zip |
Fix some compiler warnings
Diffstat (limited to 'main/src/ui/conversation_view_controller.vala')
-rw-r--r-- | main/src/ui/conversation_view_controller.vala | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/main/src/ui/conversation_view_controller.vala b/main/src/ui/conversation_view_controller.vala index b2be8ed8..dcd3e1c7 100644 --- a/main/src/ui/conversation_view_controller.vala +++ b/main/src/ui/conversation_view_controller.vala @@ -176,10 +176,14 @@ public class ConversationViewController : Object { if (clipboard.wait_is_image_available()) { clipboard.request_image((_, pixbuf) => { File file = File.new_for_path(Path.build_filename(FileManager.get_storage_dir(), Xmpp.random_uuid() + ".png")); - DataOutputStream fos = new DataOutputStream(file.create(FileCreateFlags.REPLACE_DESTINATION)); - pixbuf.save_to_stream_async.begin(fos, "png", null, () => { - open_send_file_overlay(file); - }); + try { + FileOutputStream fos = file.create(FileCreateFlags.REPLACE_DESTINATION); + pixbuf.save_to_stream_async.begin(fos, "png", null, () => { + open_send_file_overlay(file); + }); + } catch (Error e) { + warning("Could not create file to store pasted image in %s, %s", file.get_path(), e.message); + } }); } } @@ -191,8 +195,12 @@ public class ConversationViewController : Object { string[] uris = selection_data.get_uris(); // For now we only process the first dragged file if (uris.length >= 1) { - string file_path = Filename.from_uri(uris[0]); - open_send_file_overlay(File.new_for_path(file_path)); + try { + string file_path = Filename.from_uri(uris[0]); + open_send_file_overlay(File.new_for_path(file_path)); + } catch (ConvertError e) { + warning("Could not handle dragged file %s, %s", uris[0], e.message); + } } break; default: |