diff options
| -rw-r--r-- | engines/xeen/scripts.cpp | 13 | 
1 files changed, 9 insertions, 4 deletions
diff --git a/engines/xeen/scripts.cpp b/engines/xeen/scripts.cpp index dfd5c210d6..81ba0caab9 100644 --- a/engines/xeen/scripts.cpp +++ b/engines/xeen/scripts.cpp @@ -1048,11 +1048,16 @@ bool Scripts::cmdCallEvent(ParamsIterator ¶ms) {  }  bool Scripts::cmdReturn(ParamsIterator ¶ms) { -	StackEntry se = _stack.pop(); -	_currentPos = se; -	_lineNum = se.line; +	if (_stack.empty()) { +		// WORKAROUND: Some scripts in Swords of Xeen use cmdReturn as a substitute for cmdExit +		return cmdExit(params); +	} else { +		StackEntry se = _stack.pop(); +		_currentPos = se; +		_lineNum = se.line; -	return true; +		return true; +	}  }  bool Scripts::cmdSetVar(ParamsIterator ¶ms) {  | 
