Timeline: Tolerate TimelineModelAggregator::prevItem(m, -1, t)

Apparently there is some way of having a valid model index and an
invalid item index in QML root item. We don't know how that happens,
but we can work around it with a one character change.

Change-Id: Id2f611bfefe3119f3527e10b00249036d883334f
Task-number: QTCREATORBUG-16282
Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com>
This commit is contained in:
Ulf Hermann
2016-05-17 10:17:12 +02:00
parent aca8f9a731
commit f0dcda8592

View File

@@ -199,7 +199,7 @@ QVariantMap TimelineModelAggregator::prevItem(int selectedModel, int selectedIte
for (int i = 0; i < modelCount(); i++) {
const TimelineModel *currentModel = model(i);
if (selectedModel == i) {
itemIndexes[i] = (selectedItem == 0 ? currentModel->count() : selectedItem) - 1;
itemIndexes[i] = (selectedItem <= 0 ? currentModel->count() : selectedItem) - 1;
} else {
itemIndexes[i] = currentModel->lastIndex(time);
if (itemIndexes[i] == -1)