mojira.dev
MC-170124

Compound filters in the NBT path can be followed by an array index

To Reproduce

  1. /data get entity @s {}[]

Expected

Reports syntax error. Because if something matches a compound filter, it must be a TAG_Compound. You would never get something by using index from a TAG_Compound.

Actual

❌ No syntax error was reported.

Linked issues

Comments 5

Can confirm in 20w51a.

Can confirm in 21w03a.

For the same reason, [{}][] should also report a syntax error.
MC-208974 can be statically prevented if both {}[] and [{}][] become invalid syntax.

Can confirm in 1.19.

Can confirm in 1.19.2.

SPGoding

(Unassigned)

Confirmed

Platform

Low

Commands

nbt-path

1.15.2 Pre-release 2, 1.15.2, 20w06a, 20w07a, 20w09a, ..., 21w03a, 1.17 Pre-release 2, 1.19, 1.19.2, 1.21.4

Retrieved