From acda31dc26db072747f6f00b601e5fc480f058f2 Mon Sep 17 00:00:00 2001 From: Hyunjin Song Date: Mon, 20 Jul 2020 11:38:46 +0900 Subject: [PATCH] Fix crash on CLI rendering (#5579) This is a temporary workaround. To make all export options available in CLI, some properties of TimeLineWidget should be moved to a core class. --- src/core/Song.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/core/Song.cpp b/src/core/Song.cpp index 3a7d34c43d6..5f63e6ee859 100644 --- a/src/core/Song.cpp +++ b/src/core/Song.cpp @@ -767,12 +767,16 @@ void Song::startExport() m_exportSongEnd += MidiTime(1,0); m_exportSongBegin = MidiTime(0,0); - m_exportLoopBegin = m_playPos[Mode_PlaySong].m_timeLine->loopBegin() < m_exportSongEnd && - m_playPos[Mode_PlaySong].m_timeLine->loopEnd() <= m_exportSongEnd ? - m_playPos[Mode_PlaySong].m_timeLine->loopBegin() : MidiTime(0,0); - m_exportLoopEnd = m_playPos[Mode_PlaySong].m_timeLine->loopBegin() < m_exportSongEnd && - m_playPos[Mode_PlaySong].m_timeLine->loopEnd() <= m_exportSongEnd ? - m_playPos[Mode_PlaySong].m_timeLine->loopEnd() : MidiTime(0,0); + // FIXME: remove this check once we load timeline in headless mode + if (m_playPos[Mode_PlaySong].m_timeLine) + { + m_exportLoopBegin = m_playPos[Mode_PlaySong].m_timeLine->loopBegin() < m_exportSongEnd && + m_playPos[Mode_PlaySong].m_timeLine->loopEnd() <= m_exportSongEnd ? + m_playPos[Mode_PlaySong].m_timeLine->loopBegin() : MidiTime(0,0); + m_exportLoopEnd = m_playPos[Mode_PlaySong].m_timeLine->loopBegin() < m_exportSongEnd && + m_playPos[Mode_PlaySong].m_timeLine->loopEnd() <= m_exportSongEnd ? + m_playPos[Mode_PlaySong].m_timeLine->loopEnd() : MidiTime(0,0); + } m_playPos[Mode_PlaySong].setTicks( 0 ); }