Skip to content
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

Check for valid component name when setting advance limits #1215

Merged
merged 1 commit into from
Mar 13, 2022

Conversation

speth
Copy link
Member

@speth speth commented Mar 13, 2022

The Reactor::componentIndex function returns npos when an unknown component is specified, rather than throwing an error. This condition needs to be checked when setting an advance limit to avoid writing to invalid memory locations.

If applicable, fill in the issue number this pull request is fixing

Closes #1213

If applicable, provide an example illustrating new features this pull request is introducing

Checklist

  • The pull request includes a clear description of this code change
  • Commit messages have short titles and reference relevant issues
  • Build passes (scons build & scons test) and unit tests address code coverage
  • Style & formatting of contributed code follows contributing guidelines
  • The pull request is ready for review

@codecov
Copy link

codecov bot commented Mar 13, 2022

Codecov Report

Merging #1215 (ba9d49f) into main (e6a5ffd) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #1215      +/-   ##
==========================================
+ Coverage   65.42%   65.43%   +0.01%     
==========================================
  Files         320      320              
  Lines       46247    46249       +2     
  Branches    19655    19657       +2     
==========================================
+ Hits        30259    30265       +6     
+ Misses      13460    13454       -6     
- Partials     2528     2530       +2     
Impacted Files Coverage Δ
src/zeroD/Reactor.cpp 81.31% <100.00%> (+0.82%) ⬆️
src/zeroD/IdealGasReactor.cpp 87.65% <0.00%> (+2.46%) ⬆️

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

Copy link
Member

@ischoegl ischoegl 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 to me!

@ischoegl ischoegl merged commit 719275e into Cantera:main Mar 13, 2022
@speth speth deleted the fix-1213 branch July 23, 2024 15:34
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.

Simulation breaks over loop when using Reactor.set_advance_limit
2 participants