Fix another occasional segfault in block-labors

Fixes #1057
develop
lethosor 2018-05-11 22:18:26 -04:00
parent 55181bb81c
commit 018deec912
1 changed files with 5 additions and 5 deletions

@ -75,12 +75,12 @@ struct block_labors_hook : df::viewscreen_dwarfmodest {
DEFINE_VMETHOD_INTERPOSE(void, feed, (std::set<df::interface_key> *input)) DEFINE_VMETHOD_INTERPOSE(void, feed, (std::set<df::interface_key> *input))
{ {
using namespace df::enums::interface_key; using namespace df::enums::interface_key;
if (valid_mode()) df::unit *unit = Gui::getAnyUnit(this);
{ df::unit_labor labor = vector_get(unit_labors_sidemenu, *ui_look_cursor, df::unit_labor::NONE);
df::unit *unit = Gui::getAnyUnit(this); df::unit_labor_category cat = df::unit_labor_category(labor);
df::unit_labor labor = unit_labors_sidemenu[*ui_look_cursor];
df::unit_labor_category cat = df::unit_labor_category(labor);
if (valid_mode() && labor != df::unit_labor::NONE)
{
if ((input->count(SELECT) || input->count(SELECT_ALL)) && forbidden_labor(unit, labor)) if ((input->count(SELECT) || input->count(SELECT_ALL)) && forbidden_labor(unit, labor))
{ {
unit->status.labors[labor] = false; unit->status.labors[labor] = false;