-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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
Cleanup of raw nullptr
checks with Ref
#96292
Cleanup of raw nullptr
checks with Ref
#96292
Conversation
@@ -1449,7 +1449,7 @@ void ScriptEditor::_menu_option(int p_option) { | |||
|
|||
case FILE_TOOL_RELOAD_SOFT: { | |||
Ref<Script> scr = current->get_edited_resource(); | |||
if (scr == nullptr || scr.is_null()) { | |||
if (scr.is_null()) { |
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.
These cases were redunant
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.
That should be very useful!! Everything looks good.
Using `is_valid/null` over checks with `nullptr` or `ERR_FAIL_NULL` etc.
2ba67f7
to
972a81a
Compare
If there's no issues with deleting the operators for future proofing I'll go ahead and squash (I'll keep the operators in godot-cpp for backwards compatibility, as we don't have any |
I'd agree with deleting the So I think we need to keep them for compatibility. We can maybe keep them with |
I'll go ahead and split them off into a separate PR and look at perhaps adding a new define for stricter null-checks or something, as I think |
972a81a
to
194bdde
Compare
Thanks! |
Thank you! |
With optional second commit fully forbidding these comparisons, used to identify these cases, I'd say this should be integrated as we don't really permit checking against
nullptr
and it'd be good to simply enforce it, though the error messages can be a bit cryptic at times so leaving it open