[gegl] operations/core/load: Be more careful about NULL values



commit 48691e1e91532e6cf19d7f09d69da4b8e8eef310
Author: Debarshi Ray <debarshir gnome org>
Date:   Fri Feb 3 03:08:48 2017 +0100

    operations/core/load: Be more careful about NULL values
    
    It is not clear if g_content_type_guess can possibly return NULL. Let's
    continue to assume that it doesn't.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=771961

 operations/core/load.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/operations/core/load.c b/operations/core/load.c
index 6c528d3..8cf9fb2 100644
--- a/operations/core/load.c
+++ b/operations/core/load.c
@@ -234,7 +234,26 @@ do_setup (GeglOperation *operation, const gchar *path, const gchar *uri)
         content_type = NULL;
     }
 
+  if (content_type == NULL)
+    {
+      gegl_node_set (self->load,
+                     "operation", "gegl:text",
+                     "string", "Failed to detect content type",
+                     "size", 12.0,
+                     NULL);
+      goto cleanup;
+    }
+
   handler = gegl_operation_handlers_get_loader (content_type);
+  if (handler == NULL)
+    {
+      gegl_node_set (self->load,
+                     "operation", "gegl:text",
+                     "string", "Failed to find a loader",
+                     "size", 12.0,
+                     NULL);
+      goto cleanup;
+    }
 
   gegl_node_set (self->load, "operation", handler, NULL);
   if (load_from_uri == TRUE)


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