diff options
Diffstat (limited to 'src/being.cpp')
-rw-r--r-- | src/being.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/being.cpp b/src/being.cpp index 5a877d85..b984708e 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -584,10 +584,12 @@ Being::drawEmotion(Graphics *graphics, int offsetX, int offsetY) if (!mEmotion) return; - int px = mPx + offsetX + 3; - int py = mPy + offsetY - 60; + const int px = mPx + offsetX + 3; + const int py = mPy + offsetY - 60; + const int emotionIndex = mEmotion - 1; - graphics->drawImage(emotionSet->get(mEmotion - 1), px, py); + if (emotionIndex >= 0 && emotionIndex < (int) emotionSet->size()) + graphics->drawImage(emotionSet->get(emotionIndex), px, py); } void |