Merge pull request #92301 from robert-wallis/fix-code-edit-delimiter-crash

Fix crash during code editor folding and LSP
This commit is contained in:
Rémi Verschelde 2024-05-28 15:49:09 +02:00
commit a10897ddc0
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -3050,7 +3050,7 @@ void CodeEdit::_update_delimiter_cache(int p_from_line, int p_to_line) {
} }
int CodeEdit::_is_in_delimiter(int p_line, int p_column, DelimiterType p_type) const { int CodeEdit::_is_in_delimiter(int p_line, int p_column, DelimiterType p_type) const {
if (delimiters.size() == 0) { if (delimiters.size() == 0 || p_line >= delimiter_cache.size()) {
return -1; return -1;
} }
ERR_FAIL_INDEX_V(p_line, get_line_count(), 0); ERR_FAIL_INDEX_V(p_line, get_line_count(), 0);