From fbf7d73f3eaa807ae17dad7b36477e36baba0bcf Mon Sep 17 00:00:00 2001 From: driAn Date: Sun, 8 Jun 2008 16:35:30 +0000 Subject: [PATCH] spect, invalid index access git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@2160 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/clientgame.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index 129a77c7..6e021cba 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -857,7 +857,8 @@ playerent *findfollowplayer(int shiftdirection) loopv(players) if(players[i]) available.add(players[i]); if(!available.length()) return NULL; - int oldidx = available.find(players[player1->followplayercn]); + int oldidx = -1; + if(players.inrange(player1->followplayercn)) oldidx = available.find(players[player1->followplayercn]); if(oldidx<0) oldidx = 0; int idx = (oldidx+shiftdirection) % available.length(); if(idx<0) idx += available.length();