Handle block entities with nil nbt
Check if the data in a block entity is nil, so that there won't be an assign to nil map panic
Schematic: https://mcbuild.org/schematics/18554:lighthouse Test code:
file, err := os.Open("test.schematic")
if err != nil {
panic(err)
}
s, err := schematic.FromReader(file)
if err != nil {
panic(err)
}
w := srv.World()
<-w.Exec(func(tx *world.Tx) {
tx.BuildStructure(cube.Pos{}, s)
})
problem still seems to persist with uninitialized block entities getting ticked
panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x32f428]
goroutine 78 [running]: github.com/df-mc/dragonfly/server/block.BrewingStand.Tick({{}, {}, 0x0, 0x0, 0x0, 0x0}, 0x28a12c?, {0x12f, 0x73, 0x135}, ...) /home/schphe/test/dragonfly/server/block/brewing_stand.go:47 +0x38 github.com/df-mc/dragonfly/server/world.ticker.tickBlocksRandomly({0x40013fbda0?}, 0x404a20db90, {0x4046e05b88, 0x1, 0x0?}, 0x1df) /home/schphe/test/dragonfly/server/world/tick.go:169 +0x564 github.com/df-mc/dragonfly/server/world.ticker.tick({0x4046423101?}, 0x404a20db90) /home/schphe/test/dragonfly/server/world/tick.go:82 +0x354 github.com/df-mc/dragonfly/server/world.normalTransaction.Run(...) /home/schphe/test/dragonfly/server/world/tx.go:243 github.com/df-mc/dragonfly/server/world.(*World).handleTransactions(0x40001a69c0) /home/schphe/test/dragonfly/server/world/world.go:133 +0x34 created by github.com/df-mc/dragonfly/server/world.Config.New in goroutine 1 /home/schphe/test/dragonfly/server/world/conf.go:110 +0x4f0 exit status 2
I'd like to get your schematic that you used then
privately resolved @schphe's issue and is fixed in https://github.com/df-mc/schematic/pull/3 and #1100