Skip to content

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