mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-29 23:32:04 +02:00
uri-dialog: Catch errors when reading from clipboard
The clipboard.read_text_finish method might throw an error when something goes wrong. Catch it and print in debug message. There is no alternative clipboard reading, so simply ignore.
This commit is contained in:
@@ -193,8 +193,17 @@ class ClapperUriDialog extends Gtk.Dialog
|
||||
|
||||
_readTextAsyncCb(clipboard, result)
|
||||
{
|
||||
const uri = clipboard.read_text_finish(result);
|
||||
if(!uri || !Gst.uri_is_valid(uri)) return;
|
||||
let uri = null;
|
||||
|
||||
try {
|
||||
uri = clipboard.read_text_finish(result);
|
||||
}
|
||||
catch(err) {
|
||||
debug(`could not read clipboard: ${err.message}`);
|
||||
}
|
||||
|
||||
if(!uri || !Gst.uri_is_valid(uri))
|
||||
return;
|
||||
|
||||
const contentBox = this.get_content_area();
|
||||
const linkEntry = contentBox.get_last_child();
|
||||
|
Reference in New Issue
Block a user