mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-24 09:26:52 +00:00
Update MQTT.cpp (#1534)
Fix returning pointer to local variable that will become invalid when returning. Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
parent
c725a6b65f
commit
f26441727c
@ -356,8 +356,8 @@ String MQTT::downstreamPacketToJson(MeshPacket *mp)
|
|||||||
{"payload", msgPayload}};
|
{"payload", msgPayload}};
|
||||||
|
|
||||||
// serialize and return it
|
// serialize and return it
|
||||||
std::string jsonStr = jsonObj.dump();
|
static std::string jsonStr = jsonObj.dump();
|
||||||
DEBUG_MSG("serialized json message: %s\n", jsonStr.c_str());
|
DEBUG_MSG("serialized json message: %s\n", jsonStr.c_str());
|
||||||
|
|
||||||
return jsonStr.c_str();
|
return jsonStr.c_str();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user