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

View File

@@ -97,6 +97,7 @@ void CardDisplay::Update(float dt)
bool CardDisplay::CheckUserInput(int x, int y)
{
bool result = false;
unsigned int distance2;
unsigned int minDistance2 = -1;
int n = mCurr;
@@ -126,7 +127,7 @@ bool CardDisplay::CheckUserInput(int x, int y)
{
rotateLeft();
}
else if (n >= mCount)
else if (n >= mCount && mCount > 0)
{
n = mCount - 1;
}
@@ -139,12 +140,12 @@ bool CardDisplay::CheckUserInput(int x, int y)
{
mCurr = n;
mObjects[mCurr]->Entering();
result = true;
}
JGE::GetInstance()->LeftClickedProcessed();
return true;
}
return false;
return result;
}
bool CardDisplay::CheckUserInput(JButton key)