You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you build a Spotlight with an empty list of targets and afterwards call start(), it will lead to the following ArrayIndexOutOfBoundsException exception:
java.lang.ArrayIndexOutOfBoundsException: length=0; index=0 at com.takusemba.spotlight.Spotlight.showTarget(Spotlight.kt:94) at com.takusemba.spotlight.Spotlight.access$showTarget(Spotlight.kt:21) at com.takusemba.spotlight.Spotlight$startSpotlight$1.onAnimationEnd(Spotlight.kt:84) at android.animation.Animator$AnimatorListener.onAnimationEnd(Animator.java:554) at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1242) at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1484) at android.animation.AnimationHandler.doAnimationFrame(AnimationHandler.java:146) at android.animation.AnimationHandler.access$100(AnimationHandler.java:37) at android.animation.AnimationHandler$1.doFrame(AnimationHandler.java:54) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:964) at android.view.Choreographer.doCallbacks(Choreographer.java:790) at android.view.Choreographer.doFrame(Choreographer.java:721) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:951) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7356) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
I recommend adding a proper exception when you try to start the spotlight with an empty list or just check if the targets array is not empty before accessing it at line 94 in Spotlight class.
The text was updated successfully, but these errors were encountered:
Hi, thank you for reporting the issue.
Since Spotlight is not expecting empty targets, I want you to check if it's empty before adding to Spotlight.
Instead of taking care of empty targets case, I would check if it's empty or not when targets are added then throw an exception if it's empty.
I will release this fix on the next version.
Again, thank you for reporting.
If you build a Spotlight with an empty list of targets and afterwards call start(), it will lead to the following
ArrayIndexOutOfBoundsException
exception:java.lang.ArrayIndexOutOfBoundsException: length=0; index=0 at com.takusemba.spotlight.Spotlight.showTarget(Spotlight.kt:94) at com.takusemba.spotlight.Spotlight.access$showTarget(Spotlight.kt:21) at com.takusemba.spotlight.Spotlight$startSpotlight$1.onAnimationEnd(Spotlight.kt:84) at android.animation.Animator$AnimatorListener.onAnimationEnd(Animator.java:554) at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1242) at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1484) at android.animation.AnimationHandler.doAnimationFrame(AnimationHandler.java:146) at android.animation.AnimationHandler.access$100(AnimationHandler.java:37) at android.animation.AnimationHandler$1.doFrame(AnimationHandler.java:54) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:964) at android.view.Choreographer.doCallbacks(Choreographer.java:790) at android.view.Choreographer.doFrame(Choreographer.java:721) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:951) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7356) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
I recommend adding a proper exception when you try to start the spotlight with an empty list or just check if the
targets
array is not empty before accessing it at line 94 in Spotlight class.The text was updated successfully, but these errors were encountered: