Skip to content

Commit

Permalink
Only set the id attribute if the controller was found
Browse files Browse the repository at this point in the history
Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com>
  • Loading branch information
sakertooth and PhysSong authored Jan 28, 2023
1 parent 2f5266c commit 84b8fe8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/core/ControllerConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,11 @@ void ControllerConnection::saveSettings( QDomDocument & _doc, QDomElement & _thi
{
const auto& controllers = Engine::getSong()->controllers();
const auto it = std::find(controllers.begin(), controllers.end(), m_controller);
const int id = it != controllers.end() ? std::distance(controllers.begin(), it) : -1;
_this.setAttribute("id", id);
if (it != controllers.end())
{
const int id = std::distance(controllers.begin(), it);
_this.setAttribute("id", id);
}
}
}
}
Expand Down

0 comments on commit 84b8fe8

Please sign in to comment.