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

Fix nil pointer dereference panic in Find() if module by prefix is not found #252

Merged
merged 1 commit into from
Oct 26, 2023

Conversation

sengleung
Copy link
Contributor

Previously, if FindModuleByPrefix() returns nil in Find(), it would continue to call module() with nil, resulting in a nil pointer dereference panic when trying to call ParentNode() from RootNode(). The fix is to return an error if FindModuleByPrefix() returns nil.

Fixes #251

Previously, if FindModuleByPrefix() returns nil in Find(), it would
continue to call module() with nil, resulting in a nil pointer
dereference panic when trying to call ParentNode() from RootNode().
The fix is to return an error if FindModuleByPrefix() returns nil.

Fixes openconfig#251
Copy link
Contributor

@LeonGWang LeonGWang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the fix.

@coveralls
Copy link

Coverage Status

coverage: 83.677% (-0.08%) from 83.76% when pulling c1b2136 on sengleung:find-panic-fix into 944052f on openconfig:master.

@wenovus
Copy link
Collaborator

wenovus commented Oct 26, 2023

Thanks for the fix

@wenovus wenovus merged commit d57549b into openconfig:master Oct 26, 2023
5 checks passed
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.

Nil pointer dereference panic in Find() if module by prefix is not found
4 participants