different fix for #H4332 - Qt crashes upon quit

Quiting without ever examining inventory caused the Qt interface
to issue an impossible(), then crash due to deferencing a Null
pointer.  The prior fix was to suppress the validation code that
was crashing.  This changes things so that the inventory window
always gets at least one use, allowing the Qt validation code to
succeed.  tty and X11 are ok with it; win32 needs to be verified.
This commit is contained in:
PatR
2016-05-14 02:13:07 -07:00
parent cce85939b5
commit 0bd13a7a8c
2 changed files with 8 additions and 6 deletions

View File

@@ -4401,12 +4401,11 @@ void NetHackQtMenuOrTextWindow::Display(bool block)
bool NetHackQtMenuOrTextWindow::Destroy()
{
bool res;
bool res = FALSE;
if (!actual) {
/* impossible("Destroy called before we know if Menu or Text"); */
res = FALSE; // early Destroy is not impossible
} else
if (!actual)
impossible("Destroy called before we know if Menu or Text");
else
res = actual->Destroy();
return res;