Skip to content

Commit

Permalink
Fix controller loading error on loading projects
Browse files Browse the repository at this point in the history
Fixes a regression in 91f9f1a,
which added the range check into the wrong if statement.
  • Loading branch information
PhysSong committed May 9, 2019
1 parent 50796b2 commit 934ea6d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/core/ControllerConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,15 @@ void ControllerConnection::loadSettings( const QDomElement & _this )
else
{
m_controllerId = _this.attribute( "id", "-1" ).toInt();
if( m_controllerId < 0 || m_controllerId >= Engine::getSong()->controllers().size() )
if( m_controllerId < 0 )
{
qWarning( "controller index invalid\n" );
m_controllerId = -1;
}

if (!Engine::getSong()->isLoadingProject() && m_controllerId != -1)
if (!Engine::getSong()->isLoadingProject()
&& m_controllerId != -1
&& m_controllerId < Engine::getSong()->controllers().size())
{
setController( Engine::getSong()->
controllers().at( m_controllerId ) );
Expand Down

0 comments on commit 934ea6d

Please sign in to comment.