From dacfd276e37f464e070ad1275047af4994cca86d Mon Sep 17 00:00:00 2001 From: Cathy Fitzpatrick Date: Thu, 7 Oct 2010 21:52:11 -0600 Subject: [PATCH] Added bounds check to deductPp. --- src/shoddybattle/Pokemon.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/shoddybattle/Pokemon.cpp b/src/shoddybattle/Pokemon.cpp index c5fb065..edb1c26 100644 --- a/src/shoddybattle/Pokemon.cpp +++ b/src/shoddybattle/Pokemon.cpp @@ -1026,6 +1026,9 @@ void Pokemon::setPp(const int i, const int pp) { * Deduct PP from a move slot. */ void Pokemon::deductPp(const int i) { + if ((i < 0) || (i >= m_pp.size())) { + return; + } setPp(i, m_pp[i] - 1); m_moveUsed[i] = true; }