-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix potential null access in TextEdit
#90274
Conversation
scene/gui/text_edit.cpp
Outdated
@@ -7780,7 +7780,7 @@ void TextEdit::_update_gutter_width() { | |||
|
|||
/* Syntax highlighting. */ | |||
Dictionary TextEdit::_get_line_syntax_highlighting(int p_line) { | |||
return syntax_highlighter.is_null() && !setting_text ? Dictionary() : syntax_highlighter->get_line_syntax_highlighting(p_line); | |||
return syntax_highlighter.is_null() || setting_text ? Dictionary() : syntax_highlighter->get_line_syntax_highlighting(p_line); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I swapped it to setting_text
as making it syntax_highlighter.is_null() || !setting_text
made syntax highlighting go away in the editor, unsure why this condition is here but this way it didn't break the editor, if it's unnecessary I can remove that part
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add parentheses because it's not clear to me what's the precedence between ||
and ?
.
2f86917
to
978d768
Compare
978d768
to
e88d28d
Compare
e88d28d
to
d4cf294
Compare
Thanks! |
Thank you! |
The highlighter would be accessed when
setting_text == true
regardless of it being valid