From 91f9f1a890f529779931501d7f571de9cec54226 Mon Sep 17 00:00:00 2001 From: Noah Brecht Date: Sun, 14 Apr 2019 06:26:49 -0400 Subject: [PATCH] Don't try to connect to nonexistent controllers (#4939) Fixes crash on loading presets with controllers. --- src/core/ControllerConnection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/ControllerConnection.cpp b/src/core/ControllerConnection.cpp index 45e36e12fc0..4d43a4366c3 100644 --- a/src/core/ControllerConnection.cpp +++ b/src/core/ControllerConnection.cpp @@ -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;