[recipes] Be saver against crash



commit 53180557bbd7b233394e005584500e6b61f9768b
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Feb 19 07:21:27 2017 -0500

    Be saver against crash
    
    Always better to handle unexpected values without crashing.
    I just experienced this due to some other bug.

 src/gr-edit-page.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/gr-edit-page.c b/src/gr-edit-page.c
index f50f9b1..70c30cc 100644
--- a/src/gr-edit-page.c
+++ b/src/gr-edit-page.c
@@ -1526,14 +1526,16 @@ get_spiciness (GrEditPage *page)
 
         s = gtk_combo_box_get_active_id (GTK_COMBO_BOX (page->spiciness_combo));
 
-        if (strcmp (s, "mild") == 0)
+        if (g_strcmp0 (s, "mild") == 0)
                 return 15;
-        else if (strcmp (s, "spicy") == 0)
+        else if (g_strcmp0 (s, "spicy") == 0)
                 return 40;
-        else if (strcmp (s, "hot") == 0)
+        else if (g_strcmp0 (s, "hot") == 0)
                 return 65;
-        else
+        else if (g_strcmp0 (s, "extreme") == 0)
                 return 90;
+        else
+                return 0;
 }
 
 static void add_list    (GtkButton *button, GrEditPage *page);


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