[gnome-builder] core: gracefully handle NULL object instance



commit 8234562cef7b1637e286fe353b5f18d63c9e4a3a
Author: Christian Hergert <chergert redhat com>
Date:   Wed Jan 16 15:03:05 2019 -0800

    core: gracefully handle NULL object instance

 src/libide/core/ide-object.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/libide/core/ide-object.c b/src/libide/core/ide-object.c
index ffabce957..61cfedd26 100644
--- a/src/libide/core/ide-object.c
+++ b/src/libide/core/ide-object.c
@@ -1351,9 +1351,14 @@ ide_object_log (gpointer        instance,
   g_autoptr(IdeObject) root = NULL;
   va_list args;
 
-  g_assert (IDE_IS_OBJECT (instance));
+  g_assert (!instance || IDE_IS_OBJECT (instance));
 
-  root = ide_object_ref_root (instance);
+  if G_UNLIKELY (instance == NULL || !(root = ide_object_ref_root (instance)))
+    {
+      va_start (args, format);
+      g_logv (domain, level, format, args);
+      va_end (args);
+    }
 
   if (IDE_IS_CONTEXT (root))
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]