1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-20 14:55:21 +03:00

add strict argument checking for the "defaults" cli command

This commit is contained in:
jirif 2017-09-12 10:05:45 +02:00
parent 004e98457f
commit 96c7ef22c8

View file

@ -2762,9 +2762,19 @@ static void cliSave(char *cmdline)
static void cliDefaults(char *cmdline) static void cliDefaults(char *cmdline)
{ {
bool saveConfigs;
if (isEmpty(cmdline)) {
saveConfigs = true;
} else if (strncasecmp(cmdline, "nosave", 6) == 0) {
saveConfigs = false;
} else {
return;
}
cliPrintHashLine("resetting to defaults"); cliPrintHashLine("resetting to defaults");
resetConfigs(); resetConfigs();
if (isEmpty(cmdline)) { if (saveConfigs) {
cliSave(NULL); cliSave(NULL);
} }
} }