diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-06-26 00:41:35 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-06-26 00:41:35 +0300 |
commit | 5344dc6cd9156a9b67da834c9b5b4be00a62992a (patch) | |
tree | e71a20fbc231ccec6e53a718758eea447cfc7069 /src/textmanager.cpp | |
parent | 02822f84a25b261f02f5928a6cbefe103cd9491e (diff) | |
download | plus-5344dc6cd9156a9b67da834c9b5b4be00a62992a.tar.gz plus-5344dc6cd9156a9b67da834c9b5b4be00a62992a.tar.bz2 plus-5344dc6cd9156a9b67da834c9b5b4be00a62992a.tar.xz plus-5344dc6cd9156a9b67da834c9b5b4be00a62992a.zip |
Add missing checks into other files.
Diffstat (limited to 'src/textmanager.cpp')
-rw-r--r-- | src/textmanager.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
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 |