Check for nil pointer in the sources client #340
Merged
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.
What?
Its possible that the generated sources client can return a nil error and a nil pointer to the data. When this happens, the code attempts to dereferrence the nil pointer...which causes a panic. The web framework handles the panic and returns a 500 error.
RHCLOUD-31105
Why?
Consider what business or engineering goal does this PR achieves.
How?
Added more checks for nil pointers.
Testing
More tests were added to the sources client.
Anything Else?
Any other notes about the PR that would be useful for the reviewer.
Secure Coding Practices Checklist Link
Secure Coding Checklist