Strand94 / Sketchy

Prosjekt i Programvareutvikling
0 stars 1 forks source link

Game crash: IndexOutOfBoundsException #63

Open Strand94 opened 6 years ago

Strand94 commented 6 years ago

Exception in thread "LWJGL Application" java.lang.IndexOutOfBoundsException: index can't be >= size: 1 >= 4 at com.badlogic.gdx.utils.Array.get(Array.java:154) at com.badlogic.gdx.scenes.scene2d.ui.Table.computeSize(Table.java:813) at com.badlogic.gdx.scenes.scene2d.ui.Table.layout(Table.java:961) at com.badlogic.gdx.scenes.scene2d.ui.Table.layout(Table.java:757) at com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup.validate(WidgetGroup.java:115) at com.badlogic.gdx.scenes.scene2d.ui.Table.draw(Table.java:101) at com.badlogic.gdx.scenes.scene2d.Group.drawChildren(Group.java:110) at com.badlogic.gdx.scenes.scene2d.Group.draw(Group.java:57) at com.badlogic.gdx.scenes.scene2d.Stage.draw(Stage.java:128) at com.sketchy.game.Views.View.renderStage(View.java:83) at com.sketchy.game.Views.View.render(View.java:78) at com.sketchy.game.Views.RewindView.render(RewindView.java:96) at com.badlogic.gdx.Game.render(Game.java:46) at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:225) at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:126)

Strand94 commented 6 years ago

Another error, very similar so i guess its the same bug

Exception in thread "LWJGL Application" java.lang.ArrayIndexOutOfBoundsException: 1 at com.badlogic.gdx.scenes.scene2d.ui.Table.layout(Table.java:976) at com.badlogic.gdx.scenes.scene2d.ui.Table.layout(Table.java:757) at com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup.validate(WidgetGroup.java:115) at com.badlogic.gdx.scenes.scene2d.ui.Table.draw(Table.java:101) at com.badlogic.gdx.scenes.scene2d.Group.drawChildren(Group.java:110) at com.badlogic.gdx.scenes.scene2d.Group.draw(Group.java:57) at com.badlogic.gdx.scenes.scene2d.Stage.draw(Stage.java:128) at com.sketchy.game.Views.View.renderStage(View.java:83) at com.sketchy.game.Views.View.render(View.java:78) at com.sketchy.game.Views.RewindView.render(RewindView.java:96) at com.badlogic.gdx.Game.render(Game.java:46) at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:225) at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:126)

Strand94 commented 6 years ago

Another one

E/AndroidRuntime: FATAL EXCEPTION: GLThread 2853 Process: com.sketchy.game, PID: 27719 java.lang.IndexOutOfBoundsException: index can't be >= size: 2 >= 0 at com.badlogic.gdx.utils.Array.get(Array.java:154) at com.badlogic.gdx.scenes.scene2d.ui.Table.computeSize(Table.java:813) at com.badlogic.gdx.scenes.scene2d.ui.Table.layout(Table.java:961) at com.badlogic.gdx.scenes.scene2d.ui.Table.layout(Table.java:757) at com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup.validate(WidgetGroup.java:115) at com.badlogic.gdx.scenes.scene2d.ui.Table.draw(Table.java:101) at com.badlogic.gdx.scenes.scene2d.Group.drawChildren(Group.java:110) at com.badlogic.gdx.scenes.scene2d.Group.draw(Group.java:57) at com.badlogic.gdx.scenes.scene2d.Stage.draw(Stage.java:128) at com.sketchy.game.Views.View.renderStage(View.java:83) at com.sketchy.game.Views.View.render(View.java:78) at com.sketchy.game.Views.RewindView.render(RewindView.java:90) at com.badlogic.gdx.Game.render(Game.java:46) at com.badlogic.gdx.backends.android.AndroidGraphics.onDrawFrame(AndroidGraphics.java:495) at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1609) at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1293) I/Process: Sending signal. PID: 27719 SIG: 9

ivarkrabol commented 6 years ago

I think this might be caused by doing operations of libgdx classes (Scene2D) from multiple threads, like adding UI elemtents to the table while it's being rendered.

gagbaghdas commented 5 years ago

Yes. It is because of multiple threads.

leni8ec commented 4 years ago

I have the same exceptions and they really appear due to multithreading. I fixed some of these errors by implementing the following method in callback processing (loading resources, showing ads, etc.):

Gdx.app.postRunnable() - it's a thread save method https://github.com/libgdx/libgdx/wiki/Threading

But all the same, similar errors come to me, and it is not always possible to track where exactly they come from.


Exeption example:

Fatal Exception: java.lang.ArrayIndexOutOfBoundsException: length=320; index=320 at com.badlogic.gdx.graphics.g2d.BitmapFontCache.addGlyph + 408(BitmapFontCache.java:408) at com.badlogic.gdx.graphics.g2d.BitmapFontCache.addToCache + 379(BitmapFontCache.java:379) at com.badlogic.gdx.graphics.g2d.BitmapFontCache.addText + 511(BitmapFontCache.java:511) at com.badlogic.gdx.graphics.g2d.BitmapFontCache.setText + 467(BitmapFontCache.java:467) at com.badlogic.gdx.scenes.scene2d.ui.Label.layout + 215(Label.java:215) at com.badlogic.gdx.scenes.scene2d.ui.Widget.validate + 88(Widget.java:88) at com.badlogic.gdx.scenes.scene2d.ui.Label.draw + 221(Label.java:221) at com.badlogic.gdx.scenes.scene2d.Group.drawChildren + 110(Group.java:110) at com.badlogic.gdx.scenes.scene2d.Group.draw + 57(Group.java:57) at com.badlogic.gdx.scenes.scene2d.Group.drawChildren + 110(Group.java:110) at com.badlogic.gdx.scenes.scene2d.Group.draw + 57(Group.java:57) at com.badlogic.gdx.scenes.scene2d.Stage.draw + 128(Stage.java:128) at com.bonbeart.doors.seasons.engine.gui.Screen.render + 116(Screen.java:116) at com.badlogic.gdx.Game.render + 46(Game.java:46) at com.badlogic.gdx.backends.android.AndroidGraphics.onDrawFrame + 494(AndroidGraphics.java:494) at android.opengl.GLSurfaceView$GLThread.guardedRun + 1571(GLSurfaceView.java:1571) at android.opengl.GLSurfaceView$GLThread.run + 1270(GLSurfaceView.java:1270)