[gimp] lcms: avoid dereferencing null pointers



commit d0f7e713bb4478f2da3a688abf89adfdc2a935ee
Author: Nils Philippsen <nils redhat com>
Date:   Thu Nov 7 11:33:19 2013 +0100

    lcms: avoid dereferencing null pointers

 plug-ins/common/lcms.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/plug-ins/common/lcms.c b/plug-ins/common/lcms.c
index c9a6676..ccd2b81 100644
--- a/plug-ins/common/lcms.c
+++ b/plug-ins/common/lcms.c
@@ -354,10 +354,12 @@ run (const gchar      *name,
     goto done;
 
   if (proc != PROC_FILE_INFO)
-    config = gimp_get_color_configuration ();
-
-  if (config)
-    intent = config->display_intent;
+    {
+      config = gimp_get_color_configuration ();
+      /* Later code relies on config != NULL if proc != PROC_FILE_INFO */
+      g_return_if_fail (config != NULL);
+      intent = config->display_intent;
+    }
   else
     intent = GIMP_COLOR_RENDERING_INTENT_PERCEPTUAL;
 
@@ -1374,7 +1376,10 @@ lcms_icc_apply_dialog (gint32       image,
 
   run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK);
 
-  *dont_ask = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle));
+  if (dont_ask)
+    {
+      *dont_ask = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle));
+    }
 
   gtk_widget_destroy (dialog);
 


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