Skip to content
Permalink
Browse files

Fix controller loading error on loading projects

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 934ea6d0866818833caaacbe16c816b9a94c9b9a
Showing with 4 additions and 2 deletions.
  1. +4 −2 src/core/ControllerConnection.cpp
@@ -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 ) );

0 comments on commit 934ea6d

Please sign in to comment.
You can’t perform that action at this time.