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>
This commit is contained in:
Thomas Hartmann
2019-10-14 17:06:30 +02:00
parent c5bcac1cdd
commit 9a6157becd

View File

@@ -174,11 +174,13 @@ void TimelineGraphicsScene::invalidateLayout()
void TimelineGraphicsScene::updateKeyframePositionsCache()
{
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;
}
}
// snap a frame to nearest keyframe or ruler tick