Skip to content

Commit

Permalink
Fix UnmarshalMsgWithState bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ohill committed Oct 3, 2023
1 parent a679500 commit 30546c3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gen/unmarshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ func (u *unmarshalGen) Execute(p Elem) ([]string, error) {
methodRecv := methodReceiver(p)

u.p.printf("\nfunc (%s %s) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error) {", c, methodRecv)
u.p.printf("\n if st.Depth == 0 {")
u.p.printf("\n if st.AllowableDepth == 0 {")
u.p.printf("\n err = msgp.ErrMaxDepthExceeded{}")
u.p.printf("\n return")
u.p.printf("\n }")
u.p.printf("\n st.Depth--")
u.p.printf("\n st.AllowableDepth--")
next(u, p)
u.p.print("\no = bts")

Expand Down

0 comments on commit 30546c3

Please sign in to comment.