- added null pointer validation to any relevant exported function. In most cases null pointers were already being treated as 'do nothing', but there's several places where this can make the code silently fail so in these cases a VM exception will be raised, once the VM's exception handling has been repaired to provide useful diagnostics. (Right now all it does is catch the exception, print a useless message and return to the caller as if nothing has happened.)
This commit is contained in:
parent
82c2670617
commit
f9441cd9d9
17 changed files with 160 additions and 136 deletions
|
|
@ -1083,11 +1083,12 @@ DEFINE_ACTION_FUNCTION(FState, DistanceTo)
|
|||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(FState);
|
||||
PARAM_POINTER(other, FState);
|
||||
|
||||
// Safely calculate the distance between two states.
|
||||
auto o1 = FState::StaticFindStateOwner(self);
|
||||
int retv;
|
||||
if (other < o1->OwnedStates || other >= o1->OwnedStates + o1->NumOwnedStates) retv = INT_MIN;
|
||||
else retv = int(other - self);
|
||||
int retv = INT_MIN;
|
||||
if (other != nullptr)
|
||||
{
|
||||
// Safely calculate the distance between two states.
|
||||
auto o1 = FState::StaticFindStateOwner(self);
|
||||
if (other >= o1->OwnedStates && other < o1->OwnedStates + o1->NumOwnedStates) retv = int(other - self);
|
||||
}
|
||||
ACTION_RETURN_INT(retv);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue