kotlin-hashids icon indicating copy to clipboard operation
kotlin-hashids copied to clipboard

java.lang.ArrayIndexOutOfBoundsException

Open justin-mottier opened this issue 2 years ago • 0 comments

Hi, I'm getting this error:

java.lang.ArrayIndexOutOfBoundsException: length=2; index=2
        at org.Hashids.guardIndex(Hashids.kt:88)
        at org.Hashids.addGuardsIfNecessary(Hashids.kt:186)
        at org.Hashids.encode(Hashids.kt:58)

Here is the code I which cause this issue:

val hashids = Hashids("Turbo Quiz, c'est fun !", 3)
val questionId = hashids.encode(0)

It works with a minimum length of 0, 1 and 2, but from 3 it raise this error

Edit: It seems that it occurs specifically when I'm trying to encode 0

justin-mottier avatar Mar 16 '22 16:03 justin-mottier