diff --git a/src/singledocparser.cpp b/src/singledocparser.cpp index 3e5638b..65602af 100644 --- a/src/singledocparser.cpp +++ b/src/singledocparser.cpp @@ -90,16 +90,17 @@ void SingleDocParser::HandleNode(EventHandler& eventHandler) { const Token& token = m_scanner.peek(); - if (token.type == Token::PLAIN_SCALAR && IsNullString(token.value)) { + // add non-specific tags + if (tag.empty()) + tag = (token.type == Token::NON_PLAIN_SCALAR ? "!" : "?"); + + if (token.type == Token::PLAIN_SCALAR + && tag.compare("?") == 0 && IsNullString(token.value)) { eventHandler.OnNull(mark, anchor); m_scanner.pop(); return; } - // add non-specific tags - if (tag.empty()) - tag = (token.type == Token::NON_PLAIN_SCALAR ? "!" : "?"); - // now split based on what kind of node we should be switch (token.type) { case Token::PLAIN_SCALAR: