From 05191696388fc8621f044a79727cd9b0bec53b58 Mon Sep 17 00:00:00 2001 From: Martin Budden Date: Wed, 28 Dec 2016 22:53:24 +0000 Subject: [PATCH] Add check for NULL default in CLI printVtx() --- src/main/io/serial_cli.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/main/io/serial_cli.c b/src/main/io/serial_cli.c index 4cc3d2bb4..86b3dbe1c 100755 --- a/src/main/io/serial_cli.c +++ b/src/main/io/serial_cli.c @@ -2374,26 +2374,26 @@ static void cliFlashRead(char *cmdline) static void printVtx(uint8_t dumpMask, const master_t *defaultConfig) { // print out vtx channel settings - vtxChannelActivationCondition_t *cac; - vtxChannelActivationCondition_t *cacDefault; - bool equalsDefault; + const char *format = "vtx %u %u %u %u %u %u\r\n"; + bool equalsDefault = true; for (uint32_t i = 0; i < MAX_CHANNEL_ACTIVATION_CONDITION_COUNT; i++) { - cac = &masterConfig.vtxChannelActivationConditions[i]; - cacDefault = &defaultConfig->vtxChannelActivationConditions[i]; - equalsDefault = cac->auxChannelIndex == cacDefault->auxChannelIndex - && cac->band == cacDefault->band - && cac->channel == cacDefault->channel - && cac->range.startStep == cacDefault->range.startStep - && cac->range.endStep == cacDefault->range.endStep; - const char *format = "vtx %u %u %u %u %u %u\r\n"; - cliDefaultPrintf(dumpMask, equalsDefault, format, - i, - cacDefault->auxChannelIndex, - cacDefault->band, - cacDefault->channel, - MODE_STEP_TO_CHANNEL_VALUE(cacDefault->range.startStep), - MODE_STEP_TO_CHANNEL_VALUE(cacDefault->range.endStep) - ); + const vtxChannelActivationCondition_t *cac = &masterConfig.vtxChannelActivationConditions[i]; + if (defaultConfig) { + const vtxChannelActivationCondition_t *cacDefault = &defaultConfig->vtxChannelActivationConditions[i]; + equalsDefault = cac->auxChannelIndex == cacDefault->auxChannelIndex + && cac->band == cacDefault->band + && cac->channel == cacDefault->channel + && cac->range.startStep == cacDefault->range.startStep + && cac->range.endStep == cacDefault->range.endStep; + cliDefaultPrintf(dumpMask, equalsDefault, format, + i, + cacDefault->auxChannelIndex, + cacDefault->band, + cacDefault->channel, + MODE_STEP_TO_CHANNEL_VALUE(cacDefault->range.startStep), + MODE_STEP_TO_CHANNEL_VALUE(cacDefault->range.endStep) + ); + } cliDumpPrintf(dumpMask, equalsDefault, format, i, cac->auxChannelIndex,