From 8ff68f0bbe5e7cea38f001422edcd8b58e67136c Mon Sep 17 00:00:00 2001 From: Jps Date: Mon, 23 Nov 2015 17:02:17 -0500 Subject: [PATCH] esp8266gateway crashing when receiving I_CONFIG message from new node due to attempt to dereference the NULL return of MyMessage::getString() --- libraries/MySensors/core/MySensorCore.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libraries/MySensors/core/MySensorCore.cpp b/libraries/MySensors/core/MySensorCore.cpp index 0893def..202d1c8 100644 --- a/libraries/MySensors/core/MySensorCore.cpp +++ b/libraries/MySensors/core/MySensorCore.cpp @@ -241,7 +241,11 @@ void _processInternalMessages() { } else if (type == I_CONFIG) { // Pick up configuration from controller (currently only metric/imperial) // and store it in eeprom if changed - isMetric = _msg.getString()[0] == 'M' ; + if (_msg.getString() == NULL) { + isMetric = true; + } else { + isMetric = _msg.getString()[0] == 'M' ; + } _cc.isMetric = isMetric; hwWriteConfig(EEPROM_CONTROLLER_CONFIG_ADDRESS, isMetric); } else if (type == I_PRESENTATION) {