Don't try to connect to nonexistent controllers (#4939)

Fixes crash on loading presets with controllers.
This commit is contained in:
Noah Brecht
2019-04-14 06:26:49 -04:00
committed by Hyunjin Song
parent 82e3ba75c6
commit 91f9f1a890

View File

@@ -205,7 +205,7 @@ void ControllerConnection::loadSettings( const QDomElement & _this )
else
{
m_controllerId = _this.attribute( "id", "-1" ).toInt();
if( m_controllerId < 0 )
if( m_controllerId < 0 || m_controllerId >= Engine::getSong()->controllers().size() )
{
qWarning( "controller index invalid\n" );
m_controllerId = -1;