diff --git a/modules/gdscript/language_server/gdscript_extend_parser.cpp b/modules/gdscript/language_server/gdscript_extend_parser.cpp index d1febd28c66..687cd435dae 100644 --- a/modules/gdscript/language_server/gdscript_extend_parser.cpp +++ b/modules/gdscript/language_server/gdscript_extend_parser.cpp @@ -409,9 +409,11 @@ String ExtendGDScriptParser::parse_documentation(int p_line, bool p_docs_down) { doc_lines.push_front(line_comment); } } else { - String next_line = lines[MAX(0, i + step)].strip_edges(true, false); - if (next_line.begins_with("#")) { - continue; + if (i > 0 && i < lines.size() - 1) { + String next_line = lines[i + step].strip_edges(true, false); + if (next_line.begins_with("#")) { + continue; + } } break; }