From ee02edee35773798102dcc6c4d4c15801db599dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Fri, 14 Oct 2016 10:04:40 +0200 Subject: [PATCH] [escher] In text view, clean how exception (nullptr) are handled Change-Id: Ibd1c3939c910a3da741bb92f8b341e02cf0bb63c --- escher/src/text_view.cpp | 6 +----- kandinsky/src/text.cpp | 3 +++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/escher/src/text_view.cpp b/escher/src/text_view.cpp index 836f5cb67..4ac1b8a1a 100644 --- a/escher/src/text_view.cpp +++ b/escher/src/text_view.cpp @@ -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 { diff --git a/kandinsky/src/text.cpp b/kandinsky/src/text.cpp index 75e03d07e..c7b64b7c9 100644 --- a/kandinsky/src/text.cpp +++ b/kandinsky/src/text.cpp @@ -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); }