[apps/banner_view] Replace assert with escape case

This commit is contained in:
Léa Saviot
2019-05-02 16:31:14 +02:00
committed by Émilie Feral
parent 28133f378e
commit f5cdf95bc5

View File

@@ -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