[escher] In text view, clean how exception (nullptr) are handled

Change-Id: Ibd1c3939c910a3da741bb92f8b341e02cf0bb63c
This commit is contained in:
Émilie Feral
2016-10-14 10:04:40 +02:00
parent f3428f28e5
commit ee02edee35
2 changed files with 4 additions and 5 deletions

View File

@@ -37,11 +37,7 @@ void TextView::setAlignment(float horizontalAlignment, float verticalAlignment)
}
KDSize TextView::minimalSizeForOptimalDisplay() {
if (m_text == nullptr) {
return KDSizeZero;
} else {
return KDText::stringSize(m_text);
}
return KDText::stringSize(m_text);
}
void TextView::drawRect(KDContext * ctx, KDRect rect) const {

View File

@@ -3,5 +3,8 @@
#include "font.h"
KDSize KDText::stringSize(const char * text) {
if (text == nullptr) {
return KDSizeZero;
}
return KDSize(BITMAP_FONT_CHARACTER_WIDTH*strlen(text), BITMAP_FONT_CHARACTER_HEIGHT);
}