I have this piece of code working just fine. Statement in if
is true which leads me to printing TRUE
. However when I remove the content of else
statement, this gives me segmentation fault, even if it doesn't execute (still prints TRUE
).
Does anybody have any idea why whould it be that way?
if(parser->checkToken(Token::Type::Int)) {
std::cout << "TRUE" << std::endl;
parser->scanner->getToken().getNumber();
parser->advance();
} else {
std::cout << "FALSE" << std::endl;
parser->requireToken(Token::Type::String);
}
p.s. parser is unique_ptr