From 6c0a917832d4ec4818ab0ba442ea817bfdf01bc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Wed, 6 Apr 2022 10:04:05 +0200 Subject: [PATCH] selection: Return an error if trying to transfer from NULL source Part-of: --- src/core/meta-selection.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/core/meta-selection.c b/src/core/meta-selection.c index 76c342020..411db4971 100644 --- a/src/core/meta-selection.c +++ b/src/core/meta-selection.c @@ -438,6 +438,13 @@ meta_selection_transfer_async (MetaSelection *selection, task = g_task_new (selection, cancellable, callback, user_data); g_task_set_source_tag (task, meta_selection_transfer_async); + if (!selection->owners[selection_type]) + { + g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_NOT_FOUND, + "Tried to transfer from NULL selection source"); + return; + } + transfer_request = transfer_request_new (output, selection_type, size, cancellable);