Skip to content

Commit

Permalink
fix: prevent nil pointer deref on struct ErrorCode method
Browse files Browse the repository at this point in the history
  • Loading branch information
lucix-aws committed Feb 21, 2023
1 parent 4228229 commit ff68ffe
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ private void renderErrorStructure() {
String errorCode = protocolGenerator == null ? shape.getId().getName(service)
: protocolGenerator.getErrorCode(service, shape);
writer.openBlock("func (e *$L) ErrorCode() string {", "}", structureSymbol.getName(), () -> {
writer.openBlock("if e.ErrorCodeOverride == nil {", "}", () -> {
writer.openBlock("if e == nil || e.ErrorCodeOverride == nil {", "}", () -> {
writer.write("return $S", errorCode);
});
writer.write("return *e.ErrorCodeOverride");
Expand Down

0 comments on commit ff68ffe

Please sign in to comment.