From 04fb708543bf7546e236d876491e7f0f62c7c12b Mon Sep 17 00:00:00 2001 From: ehofman Date: Wed, 21 Jul 2004 10:52:40 +0000 Subject: [PATCH] Frederic Bouvier: I just discovered this : state() is not valid when _level==0, because it is doing: { return _state_stack[_state_stack.size() - 1]; } and is returning a wrong index fetch ( 0 - 1 ) == -1 Moreover, st is not used when _level==0 so the line can be moved to a safer place. --- simgear/props/props_io.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simgear/props/props_io.cxx b/simgear/props/props_io.cxx index d6b38c62..997ac971 100644 --- a/simgear/props/props_io.cxx +++ b/simgear/props/props_io.cxx @@ -133,7 +133,6 @@ checkFlag (const char * flag, bool defaultState = true) void PropsVisitor::startElement (const char * name, const XMLAttributes &atts) { - State &st = state(); const char * attval; if (_level == 0) { @@ -160,6 +159,7 @@ PropsVisitor::startElement (const char * name, const XMLAttributes &atts) } else { + State &st = state(); // Get the index. attval = atts.getValue("n"); int index = 0; -- 2.39.2