diff --git a/nbt/snbt_decode.go b/nbt/snbt_decode.go index 44d4e09..c0d9610 100644 --- a/nbt/snbt_decode.go +++ b/nbt/snbt_decode.go @@ -247,7 +247,7 @@ func writeListOrArray(e *Encoder, d *decodeState) (tagType byte, err error) { } break } - if d.opcode != scanListValue { // TAG_List + if d.opcode != scanListValue && d.opcode != scanEndValue { // TAG_List panic(phasePanicMsg) } var tagType byte diff --git a/nbt/snbt_decode_test.go b/nbt/snbt_decode_test.go index 62e3519..b1f7eed 100644 --- a/nbt/snbt_decode_test.go +++ b/nbt/snbt_decode_test.go @@ -48,6 +48,9 @@ var testCases = []testCase{ {`{d:[]}`, TagCompound, []byte{10, 0, 0, 9, 0, 1, 'd', 0, 0, 0, 0, 0, 0}}, {`{e:[]}`, TagCompound, []byte{10, 0, 0, 9, 0, 1, 'e', 0, 0, 0, 0, 0, 0}}, {`{f:[], g:[]}`, TagCompound, []byte{10, 0, 0, 9, 0, 1, 'f', 0, 0, 0, 0, 0, 9, 0, 1, 'g', 0, 0, 0, 0, 0, 0}}, + + // issue#121 + {`{a:[b],c:0B}`, TagCompound, []byte{10, 0, 0, 9, 0, 1, 'a', 8, 0, 0, 0, 1, 0, 1, 'b', 1, 0, 1, 'c', 0, 0}}, } func TestStringifiedMessage_TagType(t *testing.T) { diff --git a/nbt/snbt_scanner_test.go b/nbt/snbt_scanner_test.go index 9bf7b37..c241943 100644 --- a/nbt/snbt_scanner_test.go +++ b/nbt/snbt_scanner_test.go @@ -9,7 +9,7 @@ func TestSNBT_checkScanCode(t *testing.T) { //t.SkipNow() var s scanner s.reset() - for _, c := range []byte(`[I;123,345], `) { + for _, c := range []byte(`{b:[vanilla],c:0D}`) { t.Logf("[%c] - %d", c, s.step(&s, c)) } t.Logf("[%c] - %d", ' ', s.eof())