1
1
mirror of https://github.com/profanity-im/profanity.git synced 2025-02-02 15:08:15 -05:00

Make cmd_logging() safer

Could be that args[1] is not set.
This commit is contained in:
Michael Vetter 2020-02-25 14:55:46 +01:00
parent 1a87d7be3e
commit 240aeac4d3

View File

@ -6714,7 +6714,8 @@ cmd_logging(ProfWin *window, const char *const command, gchar **args)
return TRUE;
}
if (strcmp(args[0], "chat") == 0) {
if (strcmp(args[0], "chat") == 0 && args[1] != NULL) {
_cmd_set_boolean_preference(args[1], command, "Chat logging", PREF_CHLOG);
// if set to off, disable history
@ -6723,7 +6724,7 @@ cmd_logging(ProfWin *window, const char *const command, gchar **args)
}
return TRUE;
} else if (g_strcmp0(args[0], "group") == 0) {
} else if (g_strcmp0(args[0], "group") == 0 && args[1] != NULL) {
if (g_strcmp0(args[1], "on") == 0 || g_strcmp0(args[1], "off") == 0) {
_cmd_set_boolean_preference(args[1], command, "Groupchat logging", PREF_GRLOG);
return TRUE;