Skip to content

Commit

Permalink
adds check on whether orderlist is initialised on export
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaFiorini committed Jan 19, 2025
1 parent 95a2db4 commit ea8eda0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/order_cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,11 @@ std::string OrderList::ToJSONString()
json["version"] = ORDERLIST_JSON_OUTPUT_VERSION;
json["source"] = std::string(_openttd_revision);

if (this == nullptr) { //order list not intiailised, return an empty result
json["error"] = "Orderlist was not initialised";
return json.dump();
};

auto& SD_data = this->GetScheduledDispatchScheduleSet();
auto& headJson = json["head"];
for (unsigned int i = 0; auto &SD : SD_data) {
Expand Down

0 comments on commit ea8eda0

Please sign in to comment.