Skip to content

Commit

Permalink
Check for null timelines
Browse files Browse the repository at this point in the history
  • Loading branch information
darbyjohnston committed Jun 20, 2024
1 parent 7a40ff8 commit 15f04c3
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 31 deletions.
30 changes: 16 additions & 14 deletions lib/tlPlayApp/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -928,21 +928,23 @@ namespace tl
auto i = std::find(p.files.begin(), p.files.end(), activeFiles[0]);
if (i != p.files.end())
{
try
if (auto timeline = p.timelines[i - p.files.begin()])
{
timeline::PlayerOptions playerOptions;
playerOptions.cache.readAhead = time::invalidTime;
playerOptions.cache.readBehind = time::invalidTime;
playerOptions.timerMode =
p.settings->getValue<timeline::TimerMode>("Performance/TimerMode");
playerOptions.audioBufferFrameCount =
p.settings->getValue<size_t>("Performance/AudioBufferFrameCount");
auto timeline = p.timelines[i - p.files.begin()];
player = timeline::Player::create(timeline, _context, playerOptions);
}
catch (const std::exception& e)
{
_log(e.what(), log::Type::Error);
try
{
timeline::PlayerOptions playerOptions;
playerOptions.cache.readAhead = time::invalidTime;
playerOptions.cache.readBehind = time::invalidTime;
playerOptions.timerMode =
p.settings->getValue<timeline::TimerMode>("Performance/TimerMode");
playerOptions.audioBufferFrameCount =
p.settings->getValue<size_t>("Performance/AudioBufferFrameCount");
player = timeline::Player::create(timeline, _context, playerOptions);
}
catch (const std::exception& e)
{
_log(e.what(), log::Type::Error);
}
}
}
}
Expand Down
36 changes: 19 additions & 17 deletions lib/tlPlayQtApp/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -936,24 +936,26 @@ namespace tl
auto i = std::find(p.files.begin(), p.files.end(), activeFiles[0]);
if (i != p.files.end())
{
try
if (auto timeline = p.timelines[i - p.files.begin()])
{
timeline::PlayerOptions playerOptions;
playerOptions.cache.readAhead = time::invalidTime;
playerOptions.cache.readBehind = time::invalidTime;
playerOptions.timerMode =
p.settings->getValue<timeline::TimerMode>("Performance/TimerMode");
playerOptions.audioBufferFrameCount =
p.settings->getValue<size_t>("Performance/AudioBufferFrameCount");
auto timeline = p.timelines[i - p.files.begin()];
player.reset(new qt::TimelinePlayer(
timeline::Player::create(timeline, _context, playerOptions),
_context,
this));
}
catch (const std::exception& e)
{
_log(e.what(), log::Type::Error);
try
{
timeline::PlayerOptions playerOptions;
playerOptions.cache.readAhead = time::invalidTime;
playerOptions.cache.readBehind = time::invalidTime;
playerOptions.timerMode =
p.settings->getValue<timeline::TimerMode>("Performance/TimerMode");
playerOptions.audioBufferFrameCount =
p.settings->getValue<size_t>("Performance/AudioBufferFrameCount");
player.reset(new qt::TimelinePlayer(
timeline::Player::create(timeline, _context, playerOptions),
_context,
this));
}
catch (const std::exception& e)
{
_log(e.what(), log::Type::Error);
}
}
}
}
Expand Down

0 comments on commit 15f04c3

Please sign in to comment.