Skip to content

Commit ca2ff72

Browse files
author
Jason E. Aten, Ph.D.
committed
better array of iface nil entry handling for unmarshal too
1 parent 8f36273 commit ca2ff72

File tree

4 files changed

+329
-288
lines changed

4 files changed

+329
-288
lines changed

_generated/nodedup_generated.go

+30
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gen/spec.go

+11
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,17 @@ func (p *printer) unmarshalRangeBlock(idx string, parent Elem, t traversal, inne
574574

575575
p.printf("\n for %s := range %s {\n", idx, iter)
576576

577+
p.printf(`
578+
// detect and skip null slots in
579+
// the array/slice of interfaces.
580+
if msgp.IsNil(bts) {
581+
bts, err = msgp.Skip(bts)
582+
if err != nil {
583+
return
584+
}
585+
continue
586+
}
587+
`)
577588
p.printf(`
578589
var concreteName_%s string
579590
concreteName_%s, bts = nbs.NextStructName(bts)

testdata/generic_gen_test.go

+8-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)