diff --git a/libs/ardour/test/test_util.cc b/libs/ardour/test/test_util.cc index 8b4fba6baf..7c2cfcf020 100644 --- a/libs/ardour/test/test_util.cc +++ b/libs/ardour/test/test_util.cc @@ -49,11 +49,10 @@ check_nodes (XMLNode const * p, XMLNode const * q, list const & ignore_p XMLPropertyList const & pp = p->properties (); XMLPropertyList const & qp = q->properties (); - CPPUNIT_ASSERT_EQUAL (qp.size(), pp.size()); XMLPropertyList::const_iterator i = pp.begin (); XMLPropertyList::const_iterator j = qp.begin (); - while (i != pp.end ()) { + while (i != pp.end () && j != qp.end ()) { CPPUNIT_ASSERT_EQUAL ((*j)->name(), (*i)->name()); if (find (ignore_properties.begin(), ignore_properties.end(), (*i)->name ()) == ignore_properties.end ()) { CPPUNIT_ASSERT_EQUAL_MESSAGE ((*j)->name(), (*i)->value(), (*i)->value()); @@ -62,18 +61,21 @@ check_nodes (XMLNode const * p, XMLNode const * q, list const & ignore_p ++j; } + CPPUNIT_ASSERT_EQUAL (qp.size(), pp.size()); + XMLNodeList const & pc = p->children (); XMLNodeList const & qc = q->children (); - CPPUNIT_ASSERT_EQUAL (qc.size(), pc.size()); XMLNodeList::const_iterator k = pc.begin (); XMLNodeList::const_iterator l = qc.begin (); - while (k != pc.end ()) { + while (k != pc.end () && l != qc.end ()) { check_nodes (*k, *l, ignore_properties); ++k; ++l; } + + CPPUNIT_ASSERT_EQUAL (qc.size(), pc.size()); } void