[Escher] The TextView handles the case where its text is nullptr

Change-Id: I358b893ab64ee969f41b4f6f0df0ca6a37201de3
This commit is contained in:
Romain Goyet
2016-10-03 12:00:19 +02:00
parent 9e33577779
commit 7bc830da4f

View File

@@ -36,6 +36,9 @@ void TextView::setAlignment(float horizontalAlignment, float verticalAlignment)
}
void TextView::drawRect(KDContext * ctx, KDRect rect) const {
if (m_text == nullptr) {
return;
}
KDSize textSize = KDText::stringSize(m_text);
KDPoint origin = {
(KDCoordinate)(m_horizontalAlignment*(m_frame.width() - textSize.width())),