[Spice-devel] [spice-gtk v2] gtk-session: check if retrieving clipboard data failed

Victor Toso victortoso at redhat.com
Fri Feb 24 09:19:23 UTC 2017


From: Victor Toso <me at victortoso.com>

In case of failure, the GdkAtom *atoms will be set to NULL.
Including this check to an early return.

Signed-off-by: Victor Toso <victortoso at redhat.com>
---
 src/spice-gtk-session.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
index 0426d8f..8bef7d0 100644
--- a/src/spice-gtk-session.c
+++ b/src/spice-gtk-session.c
@@ -609,6 +609,11 @@ static void clipboard_get_targets(GtkClipboard *clipboard,
 
     g_return_if_fail(SPICE_IS_GTK_SESSION(self));
 
+    if (atoms == NULL) {
+        SPICE_DEBUG("Retrieving the clipboard data has failed");
+        return;
+    }
+
     SpiceGtkSessionPrivate *s = self->priv;
     guint32 types[SPICE_N_ELEMENTS(atom2agent)];
     char *name;
-- 
2.9.3



More information about the Spice-devel mailing list