AP_DAL: add rangefinder null guard#32827
Draft
vlordier wants to merge 1 commit intoArduPilot:masterfrom
Draft
Conversation
peterbarker
reviewed
Apr 18, 2026
| if (_RRNH.num_sensors > 0 && _RRNI == nullptr) { | ||
| _RRNI = NEW_NOTHROW log_RRNI[_RRNH.num_sensors]; | ||
| _backend = NEW_NOTHROW AP_DAL_RangeFinder_Backend *[_RRNH.num_sensors]; | ||
| _backend = NEW_NOTHROW AP_DAL_RangeFinder_Backend *[_RRNH.num_sensors]{}; |
Contributor
There was a problem hiding this comment.
What does this change accomplish?
| for (uint8_t i=0; i<_RRNH.num_sensors; i++) { | ||
| auto *backend = rangefinder->get_backend(i); | ||
| if (backend == nullptr) { | ||
| if (backend == nullptr || _backend[i] == nullptr) { |
Contributor
There was a problem hiding this comment.
Is there any flow path through ArduPilot which can result in _backend[i] being nullptr?
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.
This draft isolates the AP_DAL rangefinder null-guard fix from the larger hardening branch.
Summary:
Why:
Validation: