- fixed VM abort when entering search menu

https://forum.zdoom.org/viewtopic.php?t=65833
This commit is contained in:
alexey.lysiuk 2019-09-08 09:52:16 +03:00
parent 06ad60718c
commit 526a576d89

View file

@ -107,7 +107,10 @@ class OptionMenu : Menu
mDesc = desc; mDesc = desc;
DontDim = desc.mDontDim; DontDim = desc.mDontDim;
let last = mDesc.mItems[mDesc.mItems.size() - 1]; let itemCount = mDesc.mItems.size();
if (itemCount > 0)
{
let last = mDesc.mItems[itemCount - 1];
bool lastIsText = (last is "OptionMenuItemStaticText"); bool lastIsText = (last is "OptionMenuItemStaticText");
if (lastIsText) if (lastIsText)
{ {
@ -118,6 +121,7 @@ class OptionMenu : Menu
mDesc.mItems.Pop(); mDesc.mItems.Pop();
} }
} }
}
if (mDesc != NULL && mDesc.mSelectedItem == -1) mDesc.mSelectedItem = FirstSelectable(); if (mDesc != NULL && mDesc.mSelectedItem == -1) mDesc.mSelectedItem = FirstSelectable();
mDesc.CalcIndent(); mDesc.CalcIndent();