WorldEdit

WorldEdit

43M Downloads

Evaluating "while(0);" produces NullPointerException

j-tai opened this issue ยท 2 comments

commented

Versions
WorldEdit version:

------------------ Platforms ------------------
* Bukkit-Official(7.1.0;8e55131)

---------------- Capabilities ----------------
GAME_HOOKS: Bukkit-Official
CONFIGURATION: Bukkit-Official
USER_COMMANDS: Bukkit-Official
PERMISSIONS: Bukkit-Official
WORLDEDIT_CUI: Bukkit-Official
WORLD_EDITING: Bukkit-Official

Platform version: This server is running Paper version git-Paper-193 (MC: 1.15.2) (Implementing API version 1.15.2-R0.1-SNAPSHOT)

Describe the bug

Running //eval while(0); produces

An error occurred: Unknown error. Please see console.

A stack trace is displayed in the console:

Uncaught exception occurred in task: null
java.lang.NullPointerException: null                                                                                                           
    at com.sk89q.worldedit.internal.expression.Expression.evaluateRootTimed(Expression.java:165) ~[?:?]                                        
    at com.sk89q.worldedit.internal.expression.Expression.evaluate(Expression.java:145) ~[?:?]                                                 
    at com.sk89q.worldedit.command.UtilityCommands.lambda$calc$0(UtilityCommands.java:491) ~[?:?]                                              
    at com.sk89q.worldedit.command.util.AsyncCommandBuilder.runTask(AsyncCommandBuilder.java:139) ~[?:?]                                       
    at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTa>
    at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:58) ~[patched_1.15.2.jar:git-Paper-193]                  
    at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:75) ~[patched_1.15.2.jar:git-Paper-1>
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_232]                                           
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_232]                                           
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_232]

To Reproduce

  1. Run the command //eval while(0);.

Expected behavior
The command would produce something other than an "unknown error". Perhaps it should return null or display a message that the expression did not evaluate to anything. Displaying "unknown error" and printing a stack trace to the console suggests that it is some kind of internal error rather than a user error.

commented

Thanks for the report, thought I fixed this in a different way.

commented

Screenshot_20200418_130511