Fix wrong block statements consuming EOF token, causing a nullptr exception

This commit is contained in:
Deukhoofd 2019-06-08 14:27:24 +02:00
parent e233616b8e
commit ed6fbdbef0
No known key found for this signature in database
GPG Key ID: B4C087AC81641654
1 changed files with 1 additions and 1 deletions

View File

@ -11,7 +11,7 @@ ParsedScriptStatement* Parser::Parse() {
vector<ParsedStatement*> statements; vector<ParsedStatement*> statements;
while (true){ while (true){
auto next = this -> Next(); auto next = this -> Next();
if (next->GetKind() == TokenKind::EndOfFile){ if (next == nullptr || next->GetKind() == TokenKind::EndOfFile){
break; break;
} }
statements.push_back(this -> ParseStatement(next)); statements.push_back(this -> ParseStatement(next));