bug fixed

fixed SIGSEGV when failed to load file in nasal_lexer::openfile
This commit is contained in:
Valk Richard Li
2021-06-06 19:17:02 +08:00
parent a0ff523229
commit a3dbaebfd8
3 changed files with 9 additions and 4 deletions
+3 -1
View File
@@ -125,7 +125,8 @@ void nasal_lexer::openfile(std::string filename)
{
++error;
std::cout<<">> [lexer] cannot open file \""<<filename<<"\".\n";
fin.close();
fin.close();
res_size=0;
return;
}
while(!fin.eof())
@@ -390,6 +391,7 @@ void nasal_lexer::scanner()
}
token tk(line,tok_eof,"");
token_list.push_back(tk);
res.clear();
return;
}