mirror of
https://github.com/meshtastic/firmware.git
synced 2025-02-02 10:50:40 +00:00
Prevent null pointer dereference in setup() if radio is not available.
This commit is contained in:
parent
19c1f9fa59
commit
3611293a98
16
src/main.cpp
16
src/main.cpp
@ -658,16 +658,16 @@ 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
|
||||||
// TODO: This needs to be added what ever method changes the channel from the phone.
|
// TODO: This needs to be added what ever method changes the channel from the phone.
|
||||||
myNodeInfo.bitrate = (float(Constants_DATA_PAYLOAD_LEN) /
|
myNodeInfo.bitrate = (float(Constants_DATA_PAYLOAD_LEN) /
|
||||||
(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
|
||||||
|
Loading…
Reference in New Issue
Block a user