aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquicktabbar.cpp
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2017-05-02 13:11:44 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2017-05-02 14:07:44 +0000
commit157b0033e5efced636d441d68ef8d1d149347c38 (patch)
tree8dd3dbce9f75927e4d480363b9a6941a55882ca3 /src/quicktemplates2/qquicktabbar.cpp
parent9f63a8300f3164c5e210321d31387a56a6faeb07 (diff)
QQuickTabBarPrivate::updateLayout(): fix potential division by zero
Coverity-Id: 178896 Change-Id: I0e1f019fb452462f3fad2ecf09debcc7c3e7b8e8 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
Diffstat (limited to 'src/quicktemplates2/qquicktabbar.cpp')
-rw-r--r--src/quicktemplates2/qquicktabbar.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/quicktemplates2/qquicktabbar.cpp b/src/quicktemplates2/qquicktabbar.cpp
index 98bf94c7..c255ef1b 100644
--- a/src/quicktemplates2/qquicktabbar.cpp
+++ b/src/quicktemplates2/qquicktabbar.cpp
@@ -176,7 +176,7 @@ void QQuickTabBarPrivate::updateLayout()
const qreal totalSpacing = qMax(0, count - 1) * spacing;
totalWidth += totalSpacing;
- const qreal itemWidth = (contentItem->width() - reservedWidth - totalSpacing) / resizableCount;
+ const qreal itemWidth = (contentItem->width() - reservedWidth - totalSpacing) / qMax(1, resizableCount);
updatingLayout = true;
for (QQuickItem *item : qAsConst(allItems)) {