From f5cdf95bc50d0e99a59f33f2385e9c4d4b50dc6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Thu, 2 May 2019 16:31:14 +0200 Subject: [PATCH] [apps/banner_view] Replace assert with escape case --- apps/shared/banner_view.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/shared/banner_view.cpp b/apps/shared/banner_view.cpp index b99389d9d..aa083f127 100644 --- a/apps/shared/banner_view.cpp +++ b/apps/shared/banner_view.cpp @@ -21,7 +21,12 @@ KDSize BannerView::minimalSizeForOptimalDisplay() const { } void BannerView::layoutSubviews() { - assert(!m_frame.isEmpty()); + if (m_frame.isEmpty()) { + /* If the frame has not been set yet, there is no point in layouting the + * subviews. + * TODO: Do not call layout Subviews if the frame has not been set? */ + return; + } /* We iterate on subviews, adding their width until we exceed the view bound. * The last subview that exceeds the bound is recorded as the first subview of * the next line. For the current line, we scan again the subviews and frame