From 9adc592fb503cdf92b494c9204e4b2078660cb93 Mon Sep 17 00:00:00 2001 From: Achim Settelmeier Date: Fri, 29 May 2009 01:07:51 +0200 Subject: [PATCH] Use iterator to traverse XML tree elementsByTagName() may return an empty list thought there should be elements. As the reason and circumstances of the method for doing so are unclear, an iterator approach is used instead Signed-off-by: Tobias Doerffel --- src/core/midi/midi_control_listener.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/midi/midi_control_listener.cpp b/src/core/midi/midi_control_listener.cpp index 9573b565b..da674be7c 100644 --- a/src/core/midi/midi_control_listener.cpp +++ b/src/core/midi/midi_control_listener.cpp @@ -318,11 +318,11 @@ void MidiControlListener::readConfiguration() } // now read action tags - QDomNodeList actionNodes = s_configTree.elementsByTagName( "action" ); - for( uint i = 0; i < actionNodes.length(); ++i ) + // use iterator instead of elementsByTagName(), which under unsetteled circumstances returns an empty list + for( QDomElement actionNode = s_configTree.firstChildElement( "action" ); + !actionNode.isNull(); + actionNode = actionNode.nextSiblingElement("action") ) { - QDomElement actionNode = actionNodes.at( i ).toElement(); - EventAction action = actionName2ActionNameMap( actionNode.attribute( "actionName" ) ).action; if( actionNode.attribute( "type" ) == "key" )