mirror of
https://github.com/g4klx/MMDVMHost.git
synced 2026-04-06 06:53:42 +00:00
Always emit source_info and reflector fields in JSON output
Several JSON message builders conditionally omit fields when their values are empty or null: - DMRSlot, P25Control, NXDNControl: source_info omitted when the callsign/ID lookup returns an empty string - DStarControl: reflector omitted in RF start messages and when the reflector pointer is null in network start messages - YSFControl: reflector omitted in RF start messages Downstream consumers (such as Display-Driver) that access these fields via nlohmann::json const operator[] crash with an assertion failure when the key is absent. Always emit these fields with an empty string default so that the JSON schema is consistent regardless of lookup results or message source.
This commit is contained in:
parent
10680f51a5
commit
9b8a6c1e2c
5 changed files with 12 additions and 11 deletions
|
|
@ -1383,8 +1383,7 @@ void CP25Control::writeJSON(nlohmann::json& json, const char* source, const char
|
|||
json["destination_id"] = int(dstId);
|
||||
json["destination_type"] = grp ? "group" : "individual";
|
||||
|
||||
if (!srcInfo.empty())
|
||||
json["source_info"] = srcInfo;
|
||||
json["source_info"] = srcInfo;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue