From 5344dc6cd9156a9b67da834c9b5b4be00a62992a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 26 Jun 2015 00:41:35 +0300 Subject: Add missing checks into other files. --- src/textmanager.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/textmanager.cpp') diff --git a/src/textmanager.cpp b/src/textmanager.cpp index 7bf973b89..bbb7685a3 100644 --- a/src/textmanager.cpp +++ b/src/textmanager.cpp @@ -36,12 +36,17 @@ TextManager::TextManager() : void TextManager::addText(Text *const text) { + if (!text) + return; place(text, nullptr, text->mX, text->mY, text->mHeight); mTextList.push_back(text); } -void TextManager::moveText(Text *const text, const int x, const int y) const +void TextManager::moveText(Text *const text, + const int x, const int y) const { + if (!text) + return; text->mX = x; text->mY = y; place(text, text, text->mX, text->mY, text->mHeight); @@ -72,9 +77,14 @@ void TextManager::draw(Graphics *const graphics, BLOCK_END("TextManager::draw") } -void TextManager::place(const Text *const textObj, const Text *const omit, - const int &x A_UNUSED, int &y, const int h) const +void TextManager::place(const Text *const textObj, + const Text *const omit, + const int &x A_UNUSED, + int &y, + const int h) const { + if (!textObj) + return; const int xLeft = textObj->mX; const int xRight1 = xLeft + textObj->mWidth; const int TEST = 50; // Number of lines to test for text -- cgit v1.2.3-70-g09d2