aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Hartmann <thomas.hartmann@qt.io>2019-10-14 17:06:30 +0200
committerThomas Hartmann <thomas.hartmann@qt.io>2019-10-14 18:29:01 +0000
commit9a6157becd33bdaaeb663605d4daf27667eb65be (patch)
tree3fd7f30110472653be4bca2264c18a6a90d07246
parentc5bcac1cdd8a6f3379bf312070549087ddbdc93d (diff)
QmlDesigner: Fix crash
There is no guarantee that the timeline is valid at this point. Change-Id: I48a31b1f4c305c4764d8bebee9de16e51aec4a47 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
-rw-r--r--src/plugins/qmldesigner/components/timelineeditor/timelinegraphicsscene.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/plugins/qmldesigner/components/timelineeditor/timelinegraphicsscene.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelinegraphicsscene.cpp
index 576717228d..6c25256249 100644
--- a/src/plugins/qmldesigner/components/timelineeditor/timelinegraphicsscene.cpp
+++ b/src/plugins/qmldesigner/components/timelineeditor/timelinegraphicsscene.cpp
@@ -174,11 +174,13 @@ void TimelineGraphicsScene::invalidateLayout()
void TimelineGraphicsScene::updateKeyframePositionsCache()
{
- auto kfPos = keyframePositions();
- std::sort(kfPos.begin(), kfPos.end());
- kfPos.erase(std::unique(kfPos.begin(), kfPos.end()), kfPos.end()); // remove duplicates
+ if (currentTimeline().isValid()) {
+ auto kfPos = keyframePositions();
+ std::sort(kfPos.begin(), kfPos.end());
+ kfPos.erase(std::unique(kfPos.begin(), kfPos.end()), kfPos.end()); // remove duplicates
- m_keyframePositionsCache = kfPos;
+ m_keyframePositionsCache = kfPos;
+ }
}
// snap a frame to nearest keyframe or ruler tick