使用Drag and DropTarget Grids时遇ArrayIndexOutOfBoundsError求解决
Codename One MorphAnimation数组越界问题
我用Drag and Drop功能在屏幕上移动角色,记录位置后播放角色移动到对应网格位置的动画。该功能已正常运行一年半,最终测试中执行了以下操作:
- 创建空白存储数据库副本
- 重启应用将数据库写入模拟器内存
- 运行MoveByDrag类
移动24个角色中的第一个时,模拟器直接卡死,需强制退出,同时触发如下错误:
[EDT] 0:0:29,715 - Exception: java.lang.ArrayIndexOutOfBoundsException - Index 0 out of bounds for length 0
堆栈跟踪信息:
Index 0 out of bounds for length 0
错误调用链首行:
at com.codename1.ui.Container$MorphAnimation.updateState(Container.java:4335)
对应Container.java中MorphAnimation的updateState方法最后一行代码:
@Override protected void updateState() { if(animatedComponents != null) { int componentCount = animatedComponents.size(); for(int iter = 0 ; iter < componentCount ; iter++) { Component currentCmp = (Component)animatedComponents.elementAt(iter); currentCmp.setX(motions[0][iter].getValue()); currentCmp.setY(motions[1][iter].getValue()); currentCmp.setWidth(motions[2][iter].getValue()); currentCmp.setHeight(motions[3][iter].getValue());
编辑1:Intellij指出setHeight是错误的起始关联点。
请问有谁遇到并解决过该问题?
内容的提问来源于stack exchange,提问作者curtjacobs1
相关产品推荐
相关产品推荐

