Merge pull request #35074 from GodotExplorer/lsp-fix-34147

Fix infinite loop error in document link parsing of GDScript Language Server
This commit is contained in:
Rémi Verschelde 2020-01-13 13:05:39 +01:00 committed by GitHub
commit 854a7bd9bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -112,9 +112,10 @@ void ExtendGDScriptParser::update_document_links(const String &p_code) {
FileAccessRef fs = FileAccess::create(FileAccess::ACCESS_RESOURCES);
tokenizer.set_code(p_code);
while (true) {
if (tokenizer.get_token() == GDScriptTokenizer::TK_EOF) {
GDScriptTokenizerText::Token token = tokenizer.get_token();
if (token == GDScriptTokenizer::TK_EOF || token == GDScriptTokenizer::TK_ERROR) {
break;
} else if (tokenizer.get_token() == GDScriptTokenizer::TK_CONSTANT) {
} else if (token == GDScriptTokenizer::TK_CONSTANT) {
const Variant &const_val = tokenizer.get_token_constant();
if (const_val.get_type() == Variant::STRING) {
String path = const_val;