Skip to content

Commit

Permalink
Don't try to connect to nonexistent controllers (#4939)
Browse files Browse the repository at this point in the history
Fixes crash on loading presets with controllers.
  • Loading branch information
enp2s0 authored and PhysSong committed Apr 14, 2019
1 parent 82e3ba7 commit 91f9f1a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/ControllerConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 91f9f1a

Please sign in to comment.