[balsa/gtk4: 65/246] balsa-mblist: Add guards




commit 9bddec49ac76ec7c9f49234e57352ef47f053fa0
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Thu Jul 2 11:12:54 2020 -0400

    balsa-mblist: Add guards

 src/balsa-mblist.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/balsa-mblist.c b/src/balsa-mblist.c
index 7035abede..5c93af6ba 100644
--- a/src/balsa-mblist.c
+++ b/src/balsa-mblist.c
@@ -2431,7 +2431,11 @@ balsa_mblist_mru_get_url(GSimpleAction *action, GtkWidget *widget, GObject *obje
     const gchar *action_name;
     const gchar *url;
 
-    action_name = g_action_get_name(G_ACTION(action));
+    g_return_val_if_fail(G_IS_ACTION(action), NULL);
+    g_return_val_if_fail(GTK_IS_WIDGET(widget), NULL);
+    g_return_val_if_fail(G_IS_OBJECT(object), NULL);
+
+    action_name = g_action_get_name((GAction *) action);
     url = g_object_get_data(object, action_name);
 
     if (url == NULL) {
@@ -2452,7 +2456,11 @@ balsa_mblist_mru_get_mailbox(GSimpleAction *action, GtkWidget *widget, GObject *
     const gchar *url;
     LibBalsaMailbox *mailbox;
 
-    action_name = g_action_get_name(G_ACTION(action));
+    g_return_val_if_fail(G_IS_ACTION(action), NULL);
+    g_return_val_if_fail(GTK_IS_WIDGET(widget), NULL);
+    g_return_val_if_fail(G_IS_OBJECT(object), NULL);
+
+    action_name = g_action_get_name((GAction *) action);
     url = g_object_get_data(object, action_name);
 
     mailbox = url == NULL ? bmbl_choose_mailbox(widget) : balsa_find_mailbox_by_url(url);


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