From 7af31d6614766c2e53c5b1e6240309e2f9382abe Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 20 Apr 2018 07:21:06 +0200 Subject: LILLIPUT: Add safeguard in homeInPathFinding --- engines/lilliput/lilliput.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/lilliput/lilliput.cpp b/engines/lilliput/lilliput.cpp index 800d5b322d..97767a6005 100644 --- a/engines/lilliput/lilliput.cpp +++ b/engines/lilliput/lilliput.cpp @@ -1389,7 +1389,10 @@ void LilliputEngine::homeInPathFinding(int index) { if (enclosureSrc == -1) { int tmpVal = checkOuterEnclosure(_characterTargetPos[index]); - _characterSubTargetPos[index] = _portalPos[tmpVal]; + if (tmpVal == -1) + warning("homeInPathFinding: Unexpected negative index"); + else + _characterSubTargetPos[index] = _portalPos[tmpVal]; return; } -- cgit v1.2.3