Fixed a crash occuring when trying to select card with the mouse in an empty list

This commit is contained in:
Xawotihs
2010-12-02 20:35:42 +00:00
parent fb3129cad9
commit 802937573d
+4 -3
View File
@@ -97,6 +97,7 @@ void CardDisplay::Update(float dt)
bool CardDisplay::CheckUserInput(int x, int y) bool CardDisplay::CheckUserInput(int x, int y)
{ {
bool result = false;
unsigned int distance2; unsigned int distance2;
unsigned int minDistance2 = -1; unsigned int minDistance2 = -1;
int n = mCurr; int n = mCurr;
@@ -126,7 +127,7 @@ bool CardDisplay::CheckUserInput(int x, int y)
{ {
rotateLeft(); rotateLeft();
} }
else if (n >= mCount) else if (n >= mCount && mCount > 0)
{ {
n = mCount - 1; n = mCount - 1;
} }
@@ -139,12 +140,12 @@ bool CardDisplay::CheckUserInput(int x, int y)
{ {
mCurr = n; mCurr = n;
mObjects[mCurr]->Entering(); mObjects[mCurr]->Entering();
result = true;
} }
JGE::GetInstance()->LeftClickedProcessed(); JGE::GetInstance()->LeftClickedProcessed();
return true;
} }
return false; return result;
} }
bool CardDisplay::CheckUserInput(JButton key) bool CardDisplay::CheckUserInput(JButton key)