Fix controller loading error on loading projects

Fixes a regression in 91f9f1a890,
which added the range check into the wrong if statement.
This commit is contained in:
Hyunjin Song
2019-05-10 07:32:40 +09:00
parent 50796b2088
commit 934ea6d086

View File

@@ -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 ) );