Prevent null pointer dereference in setup() if radio is not available.

This commit is contained in:
Richard Nauber 2022-01-28 21:02:02 +01:00
parent 19c1f9fa59
commit 3611293a98

View File

@ -658,7 +658,7 @@ void setup()
if (!rIf) if (!rIf)
RECORD_CRITICALERROR(CriticalErrorCode_NoRadio); RECORD_CRITICALERROR(CriticalErrorCode_NoRadio);
else else{
router->addInterface(rIf); router->addInterface(rIf);
// Calculate and save the bit rate to myNodeInfo // Calculate and save the bit rate to myNodeInfo
@ -667,7 +667,7 @@ void setup()
(float(rIf->getPacketTime(Constants_DATA_PAYLOAD_LEN))) (float(rIf->getPacketTime(Constants_DATA_PAYLOAD_LEN)))
) * 1000; ) * 1000;
DEBUG_MSG("myNodeInfo.bitrate = %f bytes / sec\n", myNodeInfo.bitrate); DEBUG_MSG("myNodeInfo.bitrate = %f bytes / sec\n", myNodeInfo.bitrate);
}
// This must be _after_ service.init because we need our preferences loaded from flash to have proper timeout values // This must be _after_ service.init because we need our preferences loaded from flash to have proper timeout values
PowerFSM_setup(); // we will transition to ON in a couple of seconds, FIXME, only do this for cold boots, not waking from SDS PowerFSM_setup(); // we will transition to ON in a couple of seconds, FIXME, only do this for cold boots, not waking from SDS