From 30546c3b11558662bb173080d47eef0d9ec641db Mon Sep 17 00:00:00 2001 From: "145173879+ohill@users.noreply.github.com" <145173879+ohill@users.noreply.github.com> Date: Tue, 3 Oct 2023 15:16:34 -0400 Subject: [PATCH] Fix UnmarshalMsgWithState bug --- gen/unmarshal.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gen/unmarshal.go b/gen/unmarshal.go index 509d9be..7ef9a4a 100644 --- a/gen/unmarshal.go +++ b/gen/unmarshal.go @@ -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")