g_cancellable_get_fd: silently return -1 for NULL cancellable
authorOwen W. Taylor <otaylor@fishsoup.net>
Fri, 29 Jul 2011 19:38:54 +0000 (15:38 -0400)
committerDavid Zeuthen <davidz@redhat.com>
Mon, 1 Aug 2011 20:24:34 +0000 (16:24 -0400)
This keeps compatibility with previous behavior.

https://bugzilla.gnome.org/show_bug.cgi?id=655598

Signed-off-by: David Zeuthen <davidz@redhat.com>
gio/gcancellable.c

index 1c3c5b5d5266376cca05edb2f994ee6c1d769e80..8ed1b2639616a6f4c4019a1386d2f9c8acbab281 100644 (file)
@@ -348,6 +348,9 @@ g_cancellable_get_fd (GCancellable *cancellable)
 {
   GPollFD pollfd;
 
+  if (cancellable == NULL)
+         return -1;
+
 #ifdef G_OS_WIN32
   pollfd.fd = -1;
 #else