Fix manipulator crash when selecting from empty custom profession list

develop
lethosor 2015-07-31 16:46:00 -04:00
parent 01e04c24c5
commit e02815dc30
2 changed files with 8 additions and 0 deletions

@ -34,6 +34,7 @@ DFHack Future
buildingplan: Now supports hatch covers
gui/hack-wish now properly assigns quality to items.
gui/gm-editor handles lua tables properly
manipulator: fixed crash when selecting custom professions when none are found
search: fixed crash in unit list after cancelling a job
stockpiles: now checks/sanitizes filenames when saving
stocks: fixed a crash when right-clicking

@ -998,6 +998,8 @@ public:
}
void select_profession(size_t selected)
{
if (selected >= manager.templates.size())
return;
ProfessionTemplate prof = manager.templates[selected - 1];
for (auto it = units.begin(); it != units.end(); ++it)
@ -1013,6 +1015,11 @@ public:
Screen::clear();
int x = 2, y = 2;
Screen::drawBorder(" Dwarf Manipulator - Custom Profession ");
if (!manager.templates.size())
{
OutputString(COLOR_LIGHTRED, x, y, "No saved professions");
return;
}
if (selection_empty)
{
OutputString(COLOR_LIGHTRED, x, y, "No dwarves selected!");