SkriptLang / skript-reflect

Powerful reflection utilities for Skript.
MIT License
65 stars 20 forks source link

Add safety net when running sections with null inputs #99

Closed sovdeeth closed 4 months ago

sovdeeth commented 9 months ago

Is your feature request related to a problem? Please describe. When running a section, say, with 2 inputs and you provide a null input as the first one, an AIIOB will be thrown when it tries to set the (second?) variable.

Describe the solution you'd like No exception should be thrown, the variable should stay unset.

Describe alternatives you've considered This should be a simple check in Section#run()

Additional context Provided stacktrace from user:

[19:42:44 WARN]: [skript-reflect] Plugin skript-reflect v2.4 generated an exception while executing task 32
java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
        at ch.njol.skript.lang.Variable.change(Variable.java:550) ~[Skript.jar:?]
        at com.btk5h.skriptmirror.skript.reflect.sections.Section.run(Section.java:35) ~[skript-reflect.jar:?]
        at com.btk5h.skriptmirror.skript.reflect.sections.EffRunSection.lambda$walk$2(EffRunSection.java:95) ~[skript-reflect.jar:?]
        at org.bukkit.craftbukkit.v1_20_R3.scheduler.CraftTask.run(CraftTask.java:101) ~[purpur-1.20.4.jar:git-Purpur-2118]
        at org.bukkit.craftbukkit.v1_20_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:57) ~[purpur-1.20.4.jar:git-Purpur-2118]
        at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[purpur-1.20.4.jar:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
        at java.lang.Thread.run(Thread.java:840) ~[?:?]

when running

run section {ask_command_handler} async with player's uuid, arg-1

in a command as console, leading player's uuid to be unset.

Vulcano771 commented 7 months ago

Should be fixed by my pr https://github.com/SkriptLang/skript-reflect/pull/102