[gimp/gimp-2-8] lcms: avoid dereferencing null pointers



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

    lcms: avoid dereferencing null pointers
    
    (cherry picked from commit d0f7e713bb4478f2da3a688abf89adfdc2a935ee)

 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 87373fc..5974aaa 100644
--- a/plug-ins/common/lcms.c
+++ b/plug-ins/common/lcms.c
@@ -363,10 +363,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;
 
@@ -1386,7 +1388,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]