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:
Rafał Dzięgiel
2021-09-14 13:00:14 +02:00
parent 67d1b9f5bc
commit 5442b0b70a

View File

@@ -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();