Permalink
Browse files

GameScript: add hack to prevent crashing when a script deletes itself

  • Loading branch information...
1 parent c100188 commit c5c2196410355bd20799a2e8e9735c258a4397c2 @bradallred bradallred committed May 26, 2013
Showing with 6 additions and 0 deletions.
  1. +6 −0 gemrb/core/GameScript/GameScript.cpp
@@ -2273,6 +2273,12 @@ int Response::Execute(Scriptable* Sender)
{
int ret = 0; // continue or not
for (size_t i = 0; i < actions.size(); i++) {
+ if (canary == 0xdddddddd) {
+ // FIXME: hack to prevent crashing when a script deletes itself.
+ // this object has been deleted and this should not be considered a fix (it may cause unforseen problems too).
+ ret = 0;
+ break;
+ }
Action* aC = actions[i];
switch (actionflags[aC->actionID] & AF_MASK) {
case AF_IMMEDIATE:

0 comments on commit c5c2196

Please sign in to comment.