Return error on /time <invalid-section>
Fixes: 9c2b3f6579 ("Re-factor `cmd_time()`")
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
This commit is contained in:
@@ -5314,7 +5314,8 @@ cmd_time(ProfWin* window, const char* const command, gchar** args)
|
|||||||
};
|
};
|
||||||
gboolean redraw = FALSE;
|
gboolean redraw = FALSE;
|
||||||
gboolean set_all = g_strcmp0(args[0], "all") == 0;
|
gboolean set_all = g_strcmp0(args[0], "all") == 0;
|
||||||
for (size_t n = 0; n < ARRAY_SIZE(time_prefs); ++n) {
|
size_t n = 0;
|
||||||
|
for (; n < ARRAY_SIZE(time_prefs); ++n) {
|
||||||
if (!set_all && g_strcmp0(args[0], time_prefs[n].name) != 0)
|
if (!set_all && g_strcmp0(args[0], time_prefs[n].name) != 0)
|
||||||
continue;
|
continue;
|
||||||
const struct time_preferences* tp = &time_prefs[n];
|
const struct time_preferences* tp = &time_prefs[n];
|
||||||
@@ -5355,6 +5356,9 @@ cmd_time(ProfWin* window, const char* const command, gchar** args)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!set_all && n == ARRAY_SIZE(time_prefs)) {
|
||||||
|
cons_bad_cmd_usage(command);
|
||||||
|
}
|
||||||
if (redraw)
|
if (redraw)
|
||||||
ui_redraw();
|
ui_redraw();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|||||||
Reference in New Issue
Block a user