Fixed reading bad memory error

This commit is contained in:
Jesse Beder
2012-05-14 23:09:25 -05:00
parent 4ca9269e24
commit fca7b7e190

View File

@@ -253,6 +253,7 @@ namespace YAML
throw ParserException(Mark::null(), ErrorMsg::END_OF_MAP_FLOW); throw ParserException(Mark::null(), ErrorMsg::END_OF_MAP_FLOW);
Token& token = m_scanner.peek(); Token& token = m_scanner.peek();
const Mark mark = token.mark;
// first check for end // first check for end
if(token.type == Token::FLOW_MAP_END) { if(token.type == Token::FLOW_MAP_END) {
m_scanner.pop(); m_scanner.pop();
@@ -264,7 +265,7 @@ namespace YAML
m_scanner.pop(); m_scanner.pop();
HandleNode(eventHandler); HandleNode(eventHandler);
} else { } else {
eventHandler.OnNull(token.mark, NullAnchor); eventHandler.OnNull(mark, NullAnchor);
} }
// now grab value (optional) // now grab value (optional)
@@ -272,7 +273,7 @@ namespace YAML
m_scanner.pop(); m_scanner.pop();
HandleNode(eventHandler); HandleNode(eventHandler);
} else { } else {
eventHandler.OnNull(token.mark, NullAnchor); eventHandler.OnNull(mark, NullAnchor);
} }
// now eat the separator (or could be a map end, which we ignore - but if it's neither, then it's a bad node) // now eat the separator (or could be a map end, which we ignore - but if it's neither, then it's a bad node)