Skip to content

Commit

Permalink
Prevent programmable robot to kill itself, causing crash.
Browse files Browse the repository at this point in the history
  • Loading branch information
Blackvoxel committed Aug 5, 2021
1 parent 6cbddbe commit 9993362
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/ZScripting_Squirrel3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,10 @@ SQInteger function_UnofficialFastPlot(HSQUIRRELVM v)
sq_getinteger(v,4, &z);
sq_getinteger(v,5, &tmp); VoxelType = tmp;

// Avoid killing ourself as it will make nasty things

if ( (x==0) && (y==0) && (z==0) ) { sq_pushbool(v,SQFalse); return(1); }

// Test if we can do that operation.
S = (ZStoreSq3 *)sq_getforeignptr(v);
if ( (!S->Allow_WorldManipulations)) { sq_pushbool(v,SQFalse); return(1); }
Expand Down

0 comments on commit 9993362

Please sign in to comment.