[ofXml] crash when looping over getChildren() if result is empty

#1

Hello,

I’ve got a crash when I try to loop over the result of someXml.getChildren( “aTag” ) if there is no “aTag” in the ofXml.
Is this a bug ?

void ofApp::setup()
{
	ofXml xml1 ;
	xml1.parse( "<tag>AAAA</tag><tag>BBBB</tag>" ) ;
	auto children1 = xml1.getChildren( "tag" ) ;
	cout << "xml1 tags" << endl ;
	for( auto & child : children1 ) cout << child.getValue() << endl ;

	ofXml xml2 ;
	auto children2 = xml2.getChildren( "tag" ) ;
	cout << "xml2 tags" << endl ;
	for( auto & child : children2 ) {}
}

Output:

[warning] ofInit: MSYS2 has limited support for UTF-8. using French_France.1252
xml1 tags
AAAA
BBBB
xml2 tags
Assertion failed!

Program: of_v0.10.0_msys2_release\apps\Tests\Xml\bin\Xml.exe
File: src/pugixml.cpp, Line 6715

Expression: _wrap._root

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application’s support team for more information.

I can create an issue in github if needed.
Thank you.

( OF 0.10.0, msys, Windows 7)

#2

Issue created here

[edit] This error is already corrected in 0.10.1. Sorry.