openGeeksLab / codenameone

Automatically exported from code.google.com/p/codenameone
0 stars 0 forks source link

com.codename1.ui.Container.Anim.animate() throwing java.lang.ArrayIndexOutOfBoundsException #1379

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
com.codename1.ui.Container.Anim.animate() throws an 
java.lang.ArrayIndexOutOfBoundsException when a component is added to the 
animated Container whilst an animation is already registered.
The XXX is thrown when it accesses the motions array for a component which did 
not yet exist when the animation was registered. 

it does this continuously because the animation never finishes because of the 
exception. 

I suggest that the animate() method should be wrapped in a try-catch block and 
that the animation is cancelled in case of an exception.

I also suggest that the animate() method only iterates over as many entries as 
the motions array contains - use motions.length instead of componentCount. 
Either this or - another solution was to integrate the new component(s) in the 
animation by extending the animations arrays.

Original issue reported on code.google.com by Stefan.A...@gmail.com on 27 Feb 2015 at 12:21

GoogleCodeExporter commented 9 years ago
See this example code. In the real world one obvoiusly does not cause the bug 
intentionally, but how should one know whether an animation ist still in 
progress before adding a component?

Original comment by Stefan.A...@gmail.com on 3 Mar 2015 at 10:55

Attachments:

GoogleCodeExporter commented 9 years ago
Please do something about it. My app is crashing and I do not know what to do 
to prevent it.

Original comment by Stefan.A...@gmail.com on 12 Mar 2015 at 6:43