Fix uninitialized pointer being returned from Gui::getAnyUnit when on the pet list with no selection.

develop
Ben Lubar 2018-04-05 16:49:30 -05:00
parent 0a2ec30199
commit 565c1e1260
No known key found for this signature in database
GPG Key ID: 018BAB45DB2D2B24
1 changed files with 3 additions and 1 deletions

@ -917,11 +917,13 @@ df::unit *Gui::getAnyUnit(df::viewscreen *top)
if (VIRTUAL_CAST_VAR(screen, df::viewscreen_petst, top))
{
df::viewscreen_petst::T_animal animal_default;
animal_default.unit = NULL;
switch (screen->mode)
{
case df::viewscreen_petst::List:
if (!vector_get(screen->is_vermin, screen->cursor))
return vector_get(screen->animal, screen->cursor).unit;
return vector_get(screen->animal, screen->cursor, animal_default).unit;
return NULL;
case df::viewscreen_petst::SelectTrainer: