1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

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'
This commit is contained in:
Michael Vetter 2019-07-22 13:47:52 +02:00
parent d004891a29
commit 16174727f4

View File

@ -5406,6 +5406,10 @@ cmd_time(ProfWin *window, const char *const command, gchar **args)
gboolean gboolean
cmd_states(ProfWin *window, const char *const command, gchar **args) 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); _cmd_set_boolean_preference(args[0], command, "Sending chat states", PREF_STATES);
// if disabled, disable outtype and gone // if disabled, disable outtype and gone
@ -5439,6 +5443,10 @@ cmd_wintitle(ProfWin *window, const char *const command, gchar **args)
gboolean gboolean
cmd_outtype(ProfWin *window, const char *const command, gchar **args) 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); _cmd_set_boolean_preference(args[0], command, "Sending typing notifications", PREF_OUTTYPE);
// if enabled, enable states // if enabled, enable states
@ -6612,6 +6620,10 @@ cmd_autoconnect(ProfWin *window, const char *const command, gchar **args)
gboolean gboolean
cmd_chlog(ProfWin *window, const char *const command, gchar **args) 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); _cmd_set_boolean_preference(args[0], command, "Chat logging", PREF_CHLOG);
// if set to off, disable history // if set to off, disable history
@ -6633,6 +6645,10 @@ cmd_grlog(ProfWin *window, const char *const command, gchar **args)
gboolean gboolean
cmd_history(ProfWin *window, const char *const command, gchar **args) 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); _cmd_set_boolean_preference(args[0], command, "Chat history", PREF_HISTORY);
// if set to on, set chlog // if set to on, set chlog
@ -6646,6 +6662,10 @@ cmd_history(ProfWin *window, const char *const command, gchar **args)
gboolean gboolean
cmd_carbons(ProfWin *window, const char *const command, gchar **args) 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); _cmd_set_boolean_preference(args[0], command, "Message carbons preference", PREF_CARBONS);
jabber_conn_status_t conn_status = connection_get_status(); jabber_conn_status_t conn_status = connection_get_status();