summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenjamin Robin <dev@benjarobin.fr>2019-02-24 10:28:14 +0100
committerJani Heikkinen <jani.heikkinen@qt.io>2019-02-25 09:38:43 +0000
commitc231395eec3494619f4977b4c5cd845b9d7341ae (patch)
tree82d81950923b5e42dd332fd3114548354da17baa /src
parentd641c584b1ed5cfae860dc0e9b08526ae6eb2c93 (diff)
downloadqtquickcontrols-c231395eec3494619f4977b4c5cd845b9d7341ae.tar.gz
ScrollViewStyle: Avoid division by zero in extent computationv5.12.25.12.2
If the flickableItem content is empty (contentWidth / contentHeight is equal to 0), prevent the division by zero in the computation of the extent variable. Task-number: QTBUG-73691 Change-Id: I86becca9a1fa2508d1acafe09f46dfc952e4e96d Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/controls/Styles/Base/ScrollViewStyle.qml4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/controls/Styles/Base/ScrollViewStyle.qml b/src/controls/Styles/Base/ScrollViewStyle.qml
index 6750399d..36b518d3 100644
--- a/src/controls/Styles/Base/ScrollViewStyle.qml
+++ b/src/controls/Styles/Base/ScrollViewStyle.qml
@@ -370,8 +370,8 @@ Style {
property var flickableItem: control.flickableItem
property int extent: Math.max(minimumHandleLength, __styleData.horizontal ?
- Math.min(1, (flickableItem ? flickableItem.width/flickableItem.contentWidth : 1)) * bg.width :
- Math.min(1, (flickableItem ? flickableItem.height/flickableItem.contentHeight : 1)) * bg.height)
+ Math.min(1, ((flickableItem && flickableItem.contentWidth > 0.0) ? flickableItem.width/flickableItem.contentWidth : 1)) * bg.width :
+ Math.min(1, ((flickableItem && flickableItem.contentHeight > 0.0) ? flickableItem.height/flickableItem.contentHeight : 1)) * bg.height)
readonly property real range: __control.maximumValue - __control.minimumValue
readonly property real begin: __control.value - __control.minimumValue