aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Edmundson <davidedmundson@kde.org>2019-05-24 16:17:00 +0100
committerDavid Edmundson <davidedmundson@kde.org>2019-06-05 09:00:16 +0300
commit7940d57b53817f28e1a575a7c37aeed968fb2f61 (patch)
treed12ad110d6a82972321096ce380e9edc45b916fc
parentb1f45e8b04204d26ef0522e67d49f26247aa8b3b (diff)
QQuickTableView: Don't try to forceLayout with no columns
forceLayout is user invokable. If it's called before columns are loaded our call to firstColumn call QMap::firstKey will assert/crash. Insertion of columns later will trigger a layout. Change-Id: Id102e3ab4756ddd3f433037783dc70e1b29101c8 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
-rw-r--r--src/quick/items/qquicktableview.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/quick/items/qquicktableview.cpp b/src/quick/items/qquicktableview.cpp
index ac3397d2a9..83fa11a446 100644
--- a/src/quick/items/qquicktableview.cpp
+++ b/src/quick/items/qquicktableview.cpp
@@ -706,6 +706,9 @@ void QQuickTableViewPrivate::syncLoadedTableRectFromLoadedTable()
void QQuickTableViewPrivate::forceLayout()
{
+ if (loadedItems.isEmpty())
+ return;
+
columnRowPositionsInvalid = true;
clearEdgeSizeCache();
RebuildOptions rebuildOptions = RebuildOption::None;