Psi

Psi

45M Downloads

ContributorSpellCircleHandler doesn't catch StringIndexOutOfBoundsException

Partonetrain opened this issue ยท 0 comments

commented

There is currently an invalid hex code in contributors.properties. (This was fixed but the issue could still happen) This is supposed to be caught and log "Contributor " + key + " has an invalid hexcode!", but it only catches one kind of exception.

https://github.com/VazkiiMods/Psi/blob/master/src/main/java/vazkii/psi/common/core/handler/ContributorSpellCircleHandler.java#L48.
Tested in Psi-1.16-97.474, it doesn't crash but puts this in the log:

[04Nov2023 11:34:35.537] [Psi Contributor Spell Circle Loader Thread/ERROR] [psi/]: Caught previously unhandled exception :
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
	at java.lang.String.substring(String.java:1919) ~[?:1.8.0_51]
	at vazkii.psi.common.core.handler.ContributorSpellCircleHandler.lambda$load$0(ContributorSpellCircleHandler.java:48) ~[?:1.16-97.474]
	at vazkii.psi.common.core.handler.ContributorSpellCircleHandler$$Lambda$3991/357846454.applyAsInt(Unknown Source) ~[?:?]
	at java.util.stream.ReferencePipeline$4$1.accept(ReferencePipeline.java:210) ~[?:1.8.0_51]
	at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948) ~[?:1.8.0_51]
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:512) ~[?:1.8.0_51]
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:502) ~[?:1.8.0_51]
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:576) ~[?:1.8.0_51]
	at java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:255) ~[?:1.8.0_51]
	at java.util.stream.IntPipeline.toArray(IntPipeline.java:502) ~[?:1.8.0_51]
	at vazkii.psi.common.core.handler.ContributorSpellCircleHandler.load(ContributorSpellCircleHandler.java:48) ~[?:1.16-97.474]
	at vazkii.psi.common.core.handler.ContributorSpellCircleHandler$ThreadContributorListLoader.run(ContributorSpellCircleHandler.java:104) ~[?:1.16-97.474]