[gedit] Do not print critical if encoding is NULL



commit 3a48c177cc01ff2d88316e17e3bf53d749cfd190
Author: Paolo Borelli <pborelli gnome org>
Date:   Sun Mar 3 18:22:54 2013 +0100

    Do not print critical if encoding is NULL
    
    When showing a loading error, we call get_encoding inconditionally since
    we use a common response callback for all kind of errors, so the info bar
    is may not have an encoding menu at all.

 gedit/gedit-io-error-info-bar.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/gedit/gedit-io-error-info-bar.c b/gedit/gedit-io-error-info-bar.c
index d8216de..64b595e 100644
--- a/gedit/gedit-io-error-info-bar.c
+++ b/gedit/gedit-io-error-info-bar.c
@@ -737,10 +737,12 @@ gedit_conversion_error_info_bar_get_encoding (GtkWidget *info_bar)
 
        menu = g_object_get_data (G_OBJECT (info_bar), 
                                  "gedit-info-bar-encoding-menu");      
-       g_return_val_if_fail (menu, NULL);
-       
-       return gedit_encodings_combo_box_get_selected_encoding
-                                       (GEDIT_ENCODINGS_COMBO_BOX (menu));
+       if (menu != NULL)
+       {
+               return gedit_encodings_combo_box_get_selected_encoding (GEDIT_ENCODINGS_COMBO_BOX (menu));
+       }
+
+       return NULL;
 }
 
 GtkWidget *


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