[gnome-calculator] Fixed warning on non-programming mode word size changed



commit 67bb46133a7906b433dd6d0fd887c55c6d129908
Author: Robert Roth <robert roth off gmail com>
Date:   Sun Nov 21 02:23:57 2021 +0200

    Fixed warning on non-programming mode word size changed

 src/math-buttons.vala | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/src/math-buttons.vala b/src/math-buttons.vala
index 77d72ebd..7b355181 100644
--- a/src/math-buttons.vala
+++ b/src/math-buttons.vala
@@ -222,9 +222,11 @@ public class MathButtons : Gtk.Box
 
     private void on_set_word_size (SimpleAction action, Variant? param)
     {
-        equation.word_size = (param.get_int32 ());
-        string format = ngettext("%d-bit", "%d-bit", param.get_int32 ());
-        word_size_button.set_label(format.printf(param.get_int32 ()));
+        if (word_size_button != null) {
+            equation.word_size = (param.get_int32 ());
+            string format = ngettext("%d-bit", "%d-bit", param.get_int32 ());
+            word_size_button.set_label(format.printf(param.get_int32 ()));
+        }
     }
 
     private void on_insert_numeric_point (SimpleAction action, Variant? param)
@@ -617,9 +619,11 @@ public class MathButtons : Gtk.Box
 
     private void word_size_changed_cb ()
     {
-        var size = equation.word_size;
-        string format = ngettext ("%d-bit", "%d-bit", size);
-        word_size_button.set_label (format.printf(size));
+        if (word_size_button != null) {
+            var size = equation.word_size;
+            string format = ngettext ("%d-bit", "%d-bit", size);
+            word_size_button.set_label (format.printf(size));
+        }
         update_bit_button_sensitivities ();
     }
 


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