satoshinm / WebSandboxMC

Bukkit plugin providing a web-based interface with an interactive WebGL 3D preview or glimpse of your server 🕷⏳📦 ⛺
https://www.spigotmc.org/resources/websandboxmc.39415/
MIT License
19 stars 5 forks source link

1.12: NPE at io.github.satoshinm.WebSandboxMC.bridge.BlockBridge.getNotifySignChange(BlockBridge.java:881) #92

Closed satoshinm closed 7 years ago

satoshinm commented 7 years ago

Glowstone build 542 (first released 1.12 build) updated existing world, http://localhost:4081/ fails:

20:15:42 [INFO] [WebSandboxMC] New web client joined: webguest1 (anonymous) from 0:0:0:0:0:0:0:1:51160
20:15:42 [SEVERE] [WebSandboxMC] Error while executing GlowTask{id=360, plugin=WebSandboxMC v1.10.0, sync=true: io.github.satoshinm.WebSandboxMC.ws.WebSocketFrameHandler$1@4df81710}
java.lang.NullPointerException
    at io.github.satoshinm.WebSandboxMC.bridge.BlockBridge.getNotifySignChange(BlockBridge.java:881)
    at io.github.satoshinm.WebSandboxMC.bridge.BlockBridge.getDataBlockUpdateCommand(BlockBridge.java:360)
    at io.github.satoshinm.WebSandboxMC.bridge.BlockBridge.sendWorld(BlockBridge.java:173)
    at io.github.satoshinm.WebSandboxMC.ws.WebSocketServerThread.handleNewClient(WebSocketServerThread.java:181)
    at io.github.satoshinm.WebSandboxMC.ws.WebSocketServerThread.handle(WebSocketServerThread.java:208)
    at io.github.satoshinm.WebSandboxMC.ws.WebSocketFrameHandler$1.run(WebSocketFrameHandler.java:70)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at net.glowstone.scheduler.GlowTask.run(GlowTask.java:167)
    at net.glowstone.scheduler.GlowScheduler.pulse(GlowScheduler.java:152)
    at net.glowstone.scheduler.GlowScheduler.lambda$start$0(GlowScheduler.java:83)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:748)
satoshinm commented 7 years ago

The NPE is on switch (blockFace), https://github.com/GlowstoneMC/Glowkit/pull/12 Add NPE check in Sign#getFacing(), changed to not throw NPE but return null so I need to check this case too (it just moved the NullPointerException source). Who knew switch would NPE?