Repository navigation
fix: correct min pressure validation in extend_atmosphere - #1189
Merged
Merged
Conversation
The minimum pressure branch of lookup::extend_atmosphere compared new_max_pressure against atm.front().pressure and printed atm.back().pressure in the error message, both copied from the maximum pressure branch above it. The guard was therefore useless or wrong in both call shapes: - With only new_min_pressure set, new_max_pressure is NaN, so the comparison was always false and no validation happened at all, letting a non-extending minimum pass through to Atm::extend_in_pressure. - With both bounds set, the always-true comparison raised a spurious error quoting numbers that contradicted the text. Check new_min_pressure against atm.front().pressure and report the current minimum, mirroring the maximum pressure branch and the contract documented in lookup_map.h.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The minimum-pressure validation in
extend_atmospherewas comparing the wrong variable: it checkednew_max_pressureagainst the current minimum instead ofnew_min_pressure, and the error message printed the wrong atmospheric endpoint. This caused invalid minimum-pressure extension requests to either pass validation silently or produce a misleading error message. This PR fixes the comparison and the reported values so the check behaves as documented.Changes
src/core/lookup/lookup_map.cpp: Inextend_atmosphere, the guard fornew_min_pressurenow correctly testsnew_min_pressure >= atm.front().pressureinstead ofnew_max_pressure >= atm.front().pressure, and the error message now reportsatm.front().pressure(the current minimum) instead ofatm.back().pressure, so the message matches the values actually compared.No breaking changes — this only corrects validation behavior and error output.