prospector: Avoid crashing due to invalid vein materials

Fixes #1276, ref #1277
develop
lethosor 2018-05-17 19:56:48 -04:00
parent 759ba5c420
commit b551e70ffa
3 changed files with 12 additions and 5 deletions

@ -129,6 +129,7 @@ probe
Can be used to determine tile properties like temperature.
.. _prospect:
.. _prospector:
prospect
========

@ -43,6 +43,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
## Fixes
- `tweak` max-wheelbarrow: fixed conflict with building renaming
- `prospector`: fixed crash due to invalid vein materials
## Misc Improvements
- `adv-rumors`: bound to Ctrl-A

@ -177,16 +177,21 @@ void printVeins(color_ostream &con, MatMap &mat_map,
MatMap gems;
MatMap rest;
for (MatMap::const_iterator it = mat_map.begin(); it != mat_map.end(); ++it)
for (const auto &kv : mat_map)
{
df::inorganic_raw *gloss = world->raws.inorganics[it->first];
df::inorganic_raw *gloss = vector_get(world->raws.inorganics, kv.first);
if (!gloss)
{
con.printerr("invalid material gloss: %hi\n", kv.first);
continue;
}
if (gloss->material.isGem())
gems[it->first] = it->second;
gems[kv.first] = kv.second;
else if (gloss->isOre())
ores[it->first] = it->second;
ores[kv.first] = kv.second;
else
rest[it->first] = it->second;
rest[kv.first] = kv.second;
}
con << "Ores:" << std::endl;