Skip to content

[GEN][ZH] Remove unnecessary NULL pointer tests in InGameUI #1092

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

xezon
Copy link

@xezon xezon commented Jun 19, 2025

This change removes unnecessary NULL pointer tests in InGameUI and makes the compiler happy.

Unnecessary because m_worldAnimationList will not accept adding null elements and will not write null to its elements.

GeneralsMD\Code\GameEngine\Source\GameClient\InGameUI.cpp(5406): warning C6011: Dereferencing NULL pointer 'wad'.

@xezon xezon added Minor Severity: Minor < Major < Critical < Blocker Refactor Edits the code with insignificant behavior changes, is never user facing labels Jun 19, 2025
@xezon xezon force-pushed the xezon/staticanalysis2/007 branch from 0584122 to e4b5340 Compare June 20, 2025 07:31

// delete the animation instance
deleteInstance(wad->m_anim);
WorldAnimationData *wad = *it;
Copy link

Choose a reason for hiding this comment

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

i would change these up for while loops since the iterators are being erased and updated within the loop body.

Copy link
Author

Choose a reason for hiding this comment

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

I will leave it as is too keep the change difference small.

if( mData1 == TRUE )
*(Bool *)mData2 = FALSE;
break;
Copy link

Choose a reason for hiding this comment

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

Snuck into this PR but should be okay. i wonder if this fixes anything user focused.

Copy link
Author

Choose a reason for hiding this comment

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

Oh. That was not meant to be here...

Copy link
Author

Choose a reason for hiding this comment

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

Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Minor Severity: Minor < Major < Critical < Blocker Refactor Edits the code with insignificant behavior changes, is never user facing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants