If you try to run client from an incorrect directory, you get a panic (SIGSEGV), because the various images in gamecore/weaponRenderSystem.go cannot be found and are thus initialized to nil
.
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x565cab]
goroutine 9 [running]:
github.com/hajimehoshi/ebiten.(*Image).isDisposed(...)
/home/makoto/go/pkg/mod/github.com/hajimehoshi/[email protected]/image.go:57
github.com/hajimehoshi/ebiten.(*Image).DrawImage(0xc000028c80, 0x0, 0xc0001dba18, 0xc000302380, 0x4423d0)
/home/makoto/go/pkg/mod/github.com/hajimehoshi/[email protected]/image.go:135 +0x4b
mahgame/gamecore.drawBackground(0xc000028c80)
/home/makoto/Documents/samsgame/gamecore/weaponRenderSystem.go:110 +0x1d4
mahgame/gamecore.(*SamGame).Draw(0xb4cd70, 0xc000028c80)
/home/makoto/Documents/samsgame/gamecore/entities.go:93 +0x32
github.com/hajimehoshi/ebiten.(*imageDumperGameWithDraw).Draw(0xc00007fa10, 0xc000028c80)
/home/makoto/go/pkg/mod/github.com/hajimehoshi/[email protected]/run.go:230 +0x70
github.com/hajimehoshi/ebiten.(*uiContext).update(0xb008e0, 0xc0001b4420, 0x0, 0x0)
/home/makoto/go/pkg/mod/github.com/hajimehoshi/[email protected]/uicontext.go:274 +0x255
github.com/hajimehoshi/ebiten.(*uiContext).Update(0xb008e0, 0xc0001b4420, 0x876d20, 0xb008e0)
/home/makoto/go/pkg/mod/github.com/hajimehoshi/[email protected]/uicontext.go:239 +0xb4
github.com/hajimehoshi/ebiten/internal/uidriver/glfw.(*UserInterface).update(0xac24e0, 0x876d20, 0xb008e0, 0x415e6c, 0xb4ccd0)
/home/makoto/go/pkg/mod/github.com/hajimehoshi/[email protected]/internal/uidriver/glfw/ui.go:810 +0x2dc
github.com/hajimehoshi/ebiten/internal/uidriver/glfw.(*UserInterface).loop(0xac24e0, 0x876d20, 0xb008e0, 0x0, 0x0)
/home/makoto/go/pkg/mod/github.com/hajimehoshi/[email protected]/internal/uidriver/glfw/ui.go:856 +0xe5
github.com/hajimehoshi/ebiten/internal/uidriver/glfw.(*UserInterface).run(0xac24e0, 0x876d20, 0xb008e0, 0x0, 0x0)
/home/makoto/go/pkg/mod/github.com/hajimehoshi/[email protected]/internal/uidriver/glfw/ui.go:728 +0x2fe
github.com/hajimehoshi/ebiten/internal/uidriver/glfw.(*UserInterface).Run.func1(0xc000012e20, 0xc00006a720, 0xac24e0, 0x876d20, 0xb008e0)
/home/makoto/go/pkg/mod/github.com/hajimehoshi/[email protected]/internal/uidriver/glfw/ui.go:565 +0x85
created by github.com/hajimehoshi/ebiten/internal/uidriver/glfw.(*UserInterface).Run
/home/makoto/go/pkg/mod/github.com/hajimehoshi/[email protected]/internal/uidriver/glfw/ui.go:562 +0x181
exit status 2
I would like to create a PR for this, but I wanted to get your opinions on this.