about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2019-07-22 13:47:52 +0200
committerMichael Vetter <jubalh@iodoru.org>2019-07-22 13:47:52 +0200
commit16174727f48daae6d244835452139e0a1b1cb389 (patch)
treee3a4e1c3774cd698a361557d1057830c9dc975bc /src/command
parentd004891a2902d53a5545c4d5e026cbff6bb36a1f (diff)
downloadprofani-tty-16174727f48daae6d244835452139e0a1b1cb389.tar.gz
Guard against arg being NULL in cmd_funcs
This should actually never happen because we have the mechanism that
checks the commands. But let's do it in case we break something in that
mechanism and to make clang happy.

Fixes clangs: 'Argument with 'nonnull' attribute passed null'
Diffstat (limited to 'src/command')
-rw-r--r--src/command/cmd_funcs.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index a6c0011f..0099ab67 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -5406,6 +5406,10 @@ cmd_time(ProfWin *window, const char *const command, gchar **args)
 gboolean
 cmd_states(ProfWin *window, const char *const command, gchar **args)
 {
+    if (args[0] == NULL) {
+        return FALSE;
+    }
+
     _cmd_set_boolean_preference(args[0], command, "Sending chat states", PREF_STATES);
 
     // if disabled, disable outtype and gone
@@ -5439,6 +5443,10 @@ cmd_wintitle(ProfWin *window, const char *const command, gchar **args)
 gboolean
 cmd_outtype(ProfWin *window, const char *const command, gchar **args)
 {
+    if (args[0] == NULL) {
+        return FALSE;
+    }
+
     _cmd_set_boolean_preference(args[0], command, "Sending typing notifications", PREF_OUTTYPE);
 
     // if enabled, enable states
@@ -6612,6 +6620,10 @@ cmd_autoconnect(ProfWin *window, const char *const command, gchar **args)
 gboolean
 cmd_chlog(ProfWin *window, const char *const command, gchar **args)
 {
+    if (args[0] == NULL) {
+        return FALSE;
+    }
+
     _cmd_set_boolean_preference(args[0], command, "Chat logging", PREF_CHLOG);
 
     // if set to off, disable history
@@ -6633,6 +6645,10 @@ cmd_grlog(ProfWin *window, const char *const command, gchar **args)
 gboolean
 cmd_history(ProfWin *window, const char *const command, gchar **args)
 {
+    if (args[0] == NULL) {
+        return FALSE;
+    }
+
     _cmd_set_boolean_preference(args[0], command, "Chat history", PREF_HISTORY);
 
     // if set to on, set chlog
@@ -6646,6 +6662,10 @@ cmd_history(ProfWin *window, const char *const command, gchar **args)
 gboolean
 cmd_carbons(ProfWin *window, const char *const command, gchar **args)
 {
+    if (args[0] == NULL) {
+        return FALSE;
+    }
+
     _cmd_set_boolean_preference(args[0], command, "Message carbons preference", PREF_CARBONS);
 
     jabber_conn_status_t conn_status = connection_get_status();