Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with null in SectionNode section parsing #4473

Closed
TheLimeGlass opened this issue Dec 22, 2021 · 2 comments
Closed

Error with null in SectionNode section parsing #4473

TheLimeGlass opened this issue Dec 22, 2021 · 2 comments
Labels
bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. completed The issue has been fully resolved and the change will be in the next Skript update. priority: medium Issues that are detrimental to user experience (prohibitive bugs or lack of useful implementation).

Comments

@TheLimeGlass
Copy link
Contributor

TheLimeGlass commented Dec 22, 2021

[18:35:35 ERROR]: #!#! Stack trace:
[18:35:35 ERROR]: #!#! java.lang.NullPointerException: Cannot invoke "ch.njol.skript.config.SectionNode.iterator()" because "node" is null
[18:35:35 ERROR]: #!#!     at Skript.jar//ch.njol.skript.ScriptLoader.loadItems(ScriptLoader.java:1100)
[18:35:35 ERROR]: #!#!     at Skript.jar//ch.njol.skript.lang.Section.loadCode(Section.java:99)
[18:35:35 ERROR]: #!#!     at Skript.jar//ch.njol.skript.lang.Section.loadOptionalCode(Section.java:154)
[18:35:35 ERROR]: #!#!     at Skript.jar//ch.njol.skript.sections.SecLoop.init(SecLoop.java:82)
[18:35:35 ERROR]: #!#!     at Skript.jar//ch.njol.skript.lang.Section.init(Section.java:71)
[18:35:35 ERROR]: #!#!     at Skript.jar//ch.njol.skript.lang.SkriptParser.parse(SkriptParser.java:257)
[18:35:35 ERROR]: #!#!     at Skript.jar//ch.njol.skript.lang.SkriptParser.parse(SkriptParser.java:179)
[18:35:35 ERROR]: #!#!     at Skript.jar//ch.njol.skript.lang.Section.parse(Section.java:168)
[18:35:35 ERROR]: #!#!     at Skript.jar//ch.njol.skript.ScriptLoader.loadItems(ScriptLoader.java:1121)
[18:35:35 ERROR]: #!#!     at Skript.jar//ch.njol.skript.lang.function.ScriptFunction.<init>(ScriptFunction.java:46)
[18:35:35 ERROR]: #!#!     at Skript.jar//ch.njol.skript.lang.function.Functions.loadFunction(Functions.java:138)
[18:35:35 ERROR]: #!#!     at Skript.jar//ch.njol.skript.ScriptLoader.loadScript(ScriptLoader.java:721)
[18:35:35 ERROR]: #!#!     at Skript.jar//ch.njol.skript.ScriptLoader.lambda$loadScripts$4(ScriptLoader.java:525)
[18:35:35 ERROR]: #!#!     at Skript.jar//ch.njol.skript.ScriptLoader.lambda$makeFuture$2(ScriptLoader.java:417)
[18:35:35 ERROR]: #!#!     at Skript.jar//ch.njol.skript.ScriptLoader.makeFuture(ScriptLoader.java:433)
[18:35:35 ERROR]: #!#!     at Skript.jar//ch.njol.skript.ScriptLoader.loadScripts(ScriptLoader.java:524)
[18:35:35 ERROR]: #!#!     at Skript.jar//ch.njol.skript.ScriptLoader.loadScripts(ScriptLoader.java:468)
[18:35:35 ERROR]: #!#!     at Skript.jar//ch.njol.skript.Skript$1.run(Skript.java:760)
[18:35:35 ERROR]: #!#!     at org.bukkit.craftbukkit.v1_18_R1.scheduler.CraftTask.run(CraftTask.java:101)
[18:35:35 ERROR]: #!#!     at org.bukkit.craftbukkit.v1_18_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:483)
[18:35:35 ERROR]: #!#!     at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1211)
[18:35:35 ERROR]: #!#!     at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:317)
[18:35:35 ERROR]: #!#!     at java.base/java.lang.Thread.run(Thread.java:833)
[18:35:35 ERROR]: #!#!
[18:35:35 ERROR]: #!#! Version Information:
[18:35:35 ERROR]: #!#!   Skript: 2.6 (custom version)
[18:35:35 ERROR]: #!#!     Flavor: selfbuilt-unknown
[18:35:35 ERROR]: #!#!     Date: unknown
[18:35:35 ERROR]: #!#!   Bukkit: 1.18.1-R0.1-SNAPSHOT
[18:35:35 ERROR]: #!#!   Minecraft: 1.18.1
[18:35:35 ERROR]: #!#!   Java: 17.0.1 (Java HotSpot(TM) 64-Bit Server VM 17.0.1+12-LTS-39)
[18:35:35 ERROR]: #!#!   OS: Windows 10 amd64 10.0
[18:35:35 ERROR]: #!#!
[18:35:35 ERROR]: #!#! Server platform: Paper
[18:35:35 ERROR]: #!#!
[18:35:35 ERROR]: #!#! Current node: loop all players where [{zombiez::player::%player input%::map} is set]->[{zombiez::temp::player::%player input%::dead} is not set]: (NpcZombiez.sk, line 554)
[18:35:35 ERROR]: #!#! Current item: null
[18:35:35 ERROR]: #!#!
[18:35:35 ERROR]: #!#! Thread: Server thread
[18:35:35 ERROR]: #!#!
[18:35:35 ERROR]: #!#! Language: english
[18:35:35 ERROR]: #!#! Link parse mode: DISABLED
[18:35:35 ERROR]: #!#!
[18:35:35 ERROR]: #!#! End of Error.

I tried debugging this, but I had to leave early for a dinner date.

I believe the Node in the iterator of ScriptLoader#loadItems(SectionNode) is null obviously, but I couldn't figure out why it was being null. The traces lead back to the SkriptParser not parsing the expression correctly, because SkriptParser.validateLine should catch and continue if the line is invalid, but it bypassed that check somehow, which then lead to the SkriptParser to return null and causing the whole spiral after that.

Could be due to the multi condition where filter lambda [example]->[example2]

This is also used in a function

function zombiezLeave(p: player):
	delete {npcnetwork::player::%{_p}%::game}
	set {_map} to {zombiez::player::%{_p}%::map}
	subtract 1 from {zombiez::map::%{_map}%::players}
	loop all players where [{zombiez::player::%player input%::map} is set]:
		if {zombiez::temp::player::%loop-player%::dead} is not set:
			add 1 to {_alive}
	if {_alive} is not set:
		set {zombiez::map::%{_map}%::players} to 0
	teleport {_p} to {zombiez::spawn}
	loop all players where [{zombiez::player::%player input%::map} is set]->[{zombiez::temp::player::%player input%::dead} is not set]:
		add 1 to {_alive}

My build is nothing changing. It's basically the master branch as of right now.

@TheLimeGlass TheLimeGlass added bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. priority: medium Issues that are detrimental to user experience (prohibitive bugs or lack of useful implementation). labels Dec 22, 2021
@TPGamesNL
Copy link
Member

Which addons are you using?

@TheLimeGlass
Copy link
Contributor Author

SkQuery, but the error is coming from Skript's own SecLoop

@TPGamesNL TPGamesNL added the PR available Issues which have a yet-to-be merged PR resolving it label Dec 23, 2021
@TPGamesNL TPGamesNL added completed The issue has been fully resolved and the change will be in the next Skript update. and removed PR available Issues which have a yet-to-be merged PR resolving it labels Jan 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. completed The issue has been fully resolved and the change will be in the next Skript update. priority: medium Issues that are detrimental to user experience (prohibitive bugs or lack of useful implementation).
Projects
None yet
Development

No branches or pull requests

3 participants