Commit 03552a88 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Solving crash when loading a project

parent d964bcf1
......@@ -180,15 +180,20 @@ void TracksView::addMediaItem( Clip* clip, unsigned int track, MainWorkflow::Tra
{
Q_ASSERT( clip );
qDebug() << "adding clip to track"<< track;
qDebug() << "nb track video:"<< m_numVideoTrack << "nb track audio" << m_numAudioTrack;
// If there is not enough tracks to insert
// the clip do it now.
if ( trackType == MainWorkflow::VideoTrack )
{
if ( track > (quint32)m_numVideoTrack )
if ( track >= m_numVideoTrack )
{
unsigned int nbTrackToAdd = track - m_numVideoTrack;
unsigned int nbTrackToAdd = track - m_numVideoTrack + 1;
for ( unsigned int i = 0; i < nbTrackToAdd; ++i )
{
qDebug() << "adding video track";
addVideoTrack();
}
}
// Add the empty upper track
if ( track + 1 == m_numVideoTrack )
......@@ -196,11 +201,14 @@ void TracksView::addMediaItem( Clip* clip, unsigned int track, MainWorkflow::Tra
}
else if ( trackType == MainWorkflow::AudioTrack )
{
if ( track > (quint32)m_numAudioTrack )
if ( track >= m_numAudioTrack )
{
unsigned int nbTrackToAdd = track - m_numAudioTrack;
unsigned int nbTrackToAdd = track - m_numAudioTrack + 1;
for ( unsigned int i = 0; i < nbTrackToAdd; ++i )
{
qDebug() << "adding audio track";
addAudioTrack();
}
}
// Add the empty upper track
if ( track + 1 == m_numAudioTrack )
......
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