Skip to content
Snippets Groups Projects
Commit 7d6a28f0 authored by David Bergström's avatar David Bergström
Browse files

Fix bug where returning reference to {} would crash

parent bae085dd
No related branches found
No related tags found
No related merge requests found
......@@ -119,6 +119,6 @@ const std::vector<BuildDescription> & TechTreeImproved::HowToBuild(sc2::UnitType
else
{
std::cout << "No information about unit type " << sc2::UnitTypeToName(unit) << " (" << static_cast<int>(unit) << ")" << std::endl;
return {};
return empty;
}
}
\ No newline at end of file
......@@ -25,6 +25,9 @@ class TechTreeImproved
std::map<sc2::UNIT_TYPEID, std::vector<BuildDescription>> producer_to_data;
std::map<sc2::UNIT_TYPEID, std::vector<BuildDescription>> result_to_data;
// If there is no BuildDescription for a given type, a reference to tihs list is returned.
const std::vector<BuildDescription> empty {};
void parse_unit(nlohmann::json::iterator it);
public:
TechTreeImproved();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment