Fixed crash with array initialization syntax going out of range (#698)
parent
cbdda57288
commit
4d99a62d37
|
@ -152,6 +152,12 @@ bool CBotListArray::Execute(CBotStack* &pj, CBotVar* pVar)
|
|||
|
||||
pVar2 = pVar->GetItem(n, true);
|
||||
|
||||
if (pVar2 == nullptr)
|
||||
{
|
||||
pj->SetError(CBotErrOutArray, p->GetToken());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!p->Execute(pile1, pVar2)) return false; // evaluate expression
|
||||
|
||||
pile1->IncState();
|
||||
|
|
|
@ -415,7 +415,7 @@ public:
|
|||
*
|
||||
* \param index Index of the element to get
|
||||
* \param grow true to grow the array automatically if the index is out of range
|
||||
* \return CBotVar representing the array element
|
||||
* \return CBotVar representing the array element, or nullptr on error (for example going out of range)
|
||||
*/
|
||||
virtual CBotVar* GetItem(int index, bool grow = false);
|
||||
|
||||
|
|
Loading…
Reference in New Issue