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:
co-authored by
GitHub
Ben Meadors
parent
c725a6b65f
commit
f26441727c
+2
-2
@@ -356,8 +356,8 @@ String MQTT::downstreamPacketToJson(MeshPacket *mp)
|
||||
{"payload", msgPayload}};
|
||||
|
||||
// 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());
|
||||
|
||||
return jsonStr.c_str();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user