From 5184d99bdc319271ee35046640478ab76d3754cc Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 25 Oct 2013 13:45:49 +0300 Subject: add missing checks. --- src/net/tmwa/network.cpp | 2 +- src/text.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp index 8fe89ac52..9d4c60e0a 100644 --- a/src/net/tmwa/network.cpp +++ b/src/net/tmwa/network.cpp @@ -149,7 +149,7 @@ void Network::dispatchMessages() len = 10; else if (msgId == SMSG_UPDATE_HOST2) len = -1; - else if (msgId >= 0 && msgId < messagesSize) + else if (msgId >= 0 && msgId < packet_lengths_size) len = packet_lengths[msgId]; if (len == -1) diff --git a/src/text.cpp b/src/text.cpp index 887c66407..ee9e3b33a 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -46,8 +46,8 @@ Text::Text(const std::string &text, const int x, const int y, mFont(font ? font : (gui ? gui->getFont() : nullptr)), mX(x), mY(y), - mWidth(mFont->getWidth(text)), - mHeight(mFont->getHeight()), + mWidth(mFont ? mFont->getWidth(text) : 1), + mHeight(mFont ? mFont->getHeight() : 1), mXOffset(0), mText(text), mColor(color), -- cgit v1.2.3-70-g09d2