rednblackgames/HyperLap2D

Crash when overlapping polygon

Opened this issue · 2 comments

myyk commented

Describe the bug
I was drawing a polygon that wrapped around itself and caused the app to crash.

To Reproduce
I couldn't repro the bug.

Steps to reproduce the behavior:

  1. 'Create Primitive'
  2. Use 'Polygon Tool'
  3. Draw a doughnut like shape with around 20 vertices.
  4. Maybe it was random that it crashed when I had made the vertices overlap.
  5. Crash

Expected behavior
No crash.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Ubuntu
  • HyperLap2D Version: 0.1.4-snapshot 5db7ae2

Additional context
Polygon looked something like this before it crashed, with the "8"-vertex being moved over the point to the left of it:
Screenshot from 2023-11-20 15-30-30

Stacktrace from crash

java.lang.NullPointerException: Cannot read the array length because "data" is null
        at games.rednblack.editor.controller.commands.component.UpdatePolygonVerticesCommand.cloneData(UpdatePolygonVerticesCommand.java:95)
        at games.rednblack.editor.controller.commands.component.UpdatePolygonVerticesCommand.payload(UpdatePolygonVerticesCommand.java:86)
        at games.rednblack.editor.view.stage.tools.PolygonTool.vertexUp(PolygonTool.java:149)
        at games.rednblack.editor.view.ui.followers.PolygonFollower$LineClickListener.touchUp(PolygonFollower.java:287)
        at com.badlogic.gdx.scenes.scene2d.InputListener.handle(InputListener.java:71)
        at com.badlogic.gdx.scenes.scene2d.Stage.touchUp(Stage.java:354)
        at com.badlogic.gdx.InputMultiplexer.touchUp(InputMultiplexer.java:124)
        at com.badlogic.gdx.InputEventQueue.drain(InputEventQueue.java:70)
        at com.badlogic.gdx.backends.lwjgl3.DefaultLwjgl3Input.update(DefaultLwjgl3Input.java:189)
        at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Window.update(Lwjgl3Window.java:378)
        at com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationGLESFix.loop(Lwjgl3ApplicationGLESFix.java:192)
        at com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationGLESFix.<init>(Lwjgl3ApplicationGLESFix.java:166)
        at games.rednblack.editor.Main.main(Main.java:57)

fgnm commented

Really thanks for all the detailed reports :) In the last commit I probably catch up the NPE but not sure, I'll let this open if you experience other crashes

myyk commented

No problem, I'm glad they're helpful. I felt bad creating them but then realized I would appreciate them created for my projects.