Skip to content

[GEN][ZH] Prevent dereferencing NULL pointer 'that' in PhysicsBehavior::transferVelocityTo() #1101

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

Merged
merged 1 commit into from
Jun 21, 2025

Conversation

xezon
Copy link

@xezon xezon commented Jun 19, 2025

This change prevents dereferencing NULL pointer 'that' in PhysicsBehavior::transferVelocityTo() to make the compiler happy.

GeneralsMD\Code\GameEngine\Source\GameLogic\Object\Update\PhysicsUpdate.cpp(1071): warning C6011: Dereferencing NULL pointer 'that'.

@xezon xezon added Minor Severity: Minor < Major < Critical < Blocker Fix Is fixing something labels Jun 19, 2025
@xezon xezon force-pushed the xezon/staticanalysis2/014 branch from 6cde63b to 8a87098 Compare June 20, 2025 07:33
Copy link

@Mauller Mauller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good and i think they meant to return early.

Comment on lines 944 to +945
if (that != NULL)
{
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be cleaner to return early.

if (that == NULL)
    return;

...

Copy link

@Caball009 Caball009 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to me like a classic case why curly braces are recommended for if statements (except continue / break / return maybe).

Looks good.

@xezon xezon merged commit adacc22 into TheSuperHackers:main Jun 21, 2025
14 checks passed
@xezon xezon deleted the xezon/staticanalysis2/014 branch June 21, 2025 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fix Is fixing something Minor Severity: Minor < Major < Critical < Blocker
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants