Commit 022ece85 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix possible crash on invalid active track

Fixes #114
parent d8d1aaad
...@@ -855,8 +855,8 @@ void ProjectManager::updateTimeline(int pos, int scrollPos) ...@@ -855,8 +855,8 @@ void ProjectManager::updateTimeline(int pos, int scrollPos)
pCore->window()->getMainTimeline()->controller()->setZone(m_project->zone()); pCore->window()->getMainTimeline()->controller()->setZone(m_project->zone());
pCore->window()->getMainTimeline()->controller()->setTargetTracks(m_project->targetTracks()); pCore->window()->getMainTimeline()->controller()->setTargetTracks(m_project->targetTracks());
pCore->window()->getMainTimeline()->controller()->setScrollPos(m_project->getDocumentProperty(QStringLiteral("scrollPos")).toInt()); pCore->window()->getMainTimeline()->controller()->setScrollPos(m_project->getDocumentProperty(QStringLiteral("scrollPos")).toInt());
int activeTrackPosition = m_project->getDocumentProperty(QStringLiteral("activeTrack")).toInt(); int activeTrackPosition = m_project->getDocumentProperty(QStringLiteral("activeTrack"), QString::number( - 1)).toInt();
if (activeTrackPosition > -1) { if (activeTrackPosition > -1 && activeTrackPosition < m_mainTimelineModel->getTracksCount()) {
pCore->window()->getMainTimeline()->controller()->setActiveTrack(m_mainTimelineModel->getTrackIndexFromPosition(activeTrackPosition)); pCore->window()->getMainTimeline()->controller()->setActiveTrack(m_mainTimelineModel->getTrackIndexFromPosition(activeTrackPosition));
} }
m_mainTimelineModel->setUndoStack(m_project->commandStack()); m_mainTimelineModel->setUndoStack(m_project->commandStack());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment