fix potential nil deref in waiter path matcher #563
Merged
+48
−17
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.
Fixes #562
Basically, whenever you have a sub-expression (visit the left, then pass the result to the right), you need to check whether the left can be nil. If it can, then the generated code has to check for that, pre-declaring a variable for the result of the right, which the generated RHS code would then store the result in if it passes the nil check.
Take a look at the updated tests for some examples.
Verified that all downstream waiters in aws-sdk-go-v2 compile with this change (including the ones we haven't enabled generated path matchers for yet).