Skip to content

Fix null pointer references #533

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: master
Choose a base branch
from
Open

Fix null pointer references #533

wants to merge 2 commits into from

Conversation

bje-
Copy link

@bje- bje- commented Mar 25, 2025

Some code in solar_technology.cpp tries to guard against pInfo being NULL, but gets it wrong. The usual idiom is if (p && p->foo), but to keep this change consistent with other examples in this file, I've used if (!p || p->foo). Note that this was flagged by GCC warnings.

solar_technology.cpp:382:34: warning: ‘this’ pointer is null [-Wnonnull]
  382 |    if ( pInfo || !pInfo->hasValue( "no-sun-days" ) )
      |                   ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~

@bje- bje- changed the title Fix null pointer reference in solar_technology.cpp Fix null pointer references Mar 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant