OpenFactorioServerManager / factorio-server-manager

A tool to help manage Factorio multiplayer servers including mods and save games.
MIT License
544 stars 132 forks source link

Panic, when no save is present #206

Closed knoxfighter closed 3 years ago

knoxfighter commented 3 years ago
2020/12/27 15:33:51 http: panic serving 127.0.0.1:46046: runtime error: invalid memory address or nil pointer dereference
goroutine 68 [running]:
net/http.(*conn).serve.func1(0xc0000f8000)
        /snap/go/current/src/net/http/server.go:1801 +0x147
panic(0x8465a0, 0xb8dcc0)
        /snap/go/current/src/runtime/panic.go:975 +0x47a
github.com/mroote/factorio-server-manager/factorio.ListSaves.func1(0xc0000265a0, 0x1c, 0x0, 0x0, 0x94c820, 0xc000433680, 0xc00050f520, 0x415e6b)
        /home/knox/Desktop/Programme/GO/factorio-server-manager/manager/src/factorio/saves.go:28 +0x40
path/filepath.Walk(0xc0000265a0, 0x1c, 0xc00050f510, 0x10, 0x82f4a0)
        /snap/go/current/src/path/filepath/path.go:404 +0x6b
github.com/mroote/factorio-server-manager/factorio.ListSaves(0xc0000265a0, 0x1c, 0xbce000, 0x0, 0x0, 0x37, 0x39)
        /home/knox/Desktop/Programme/GO/factorio-server-manager/manager/src/factorio/saves.go:27 +0x85
github.com/mroote/factorio-server-manager/api.ListSaves(0x953c60, 0xc00015cee0, 0xc0007a3e00)
        /home/knox/Desktop/Programme/GO/factorio-server-manager/manager/src/api/handlers.go:65 +0x23c
net/http.HandlerFunc.ServeHTTP(0x8e5000, 0x953c60, 0xc00015cee0, 0xc0007a3e00)
        /snap/go/current/src/net/http/server.go:2042 +0x44
github.com/mroote/factorio-server-manager/api.AuthorizeHandler.func1(0x953c60, 0xc00015cee0, 0xc0007a3e00)
        /home/knox/Desktop/Programme/GO/factorio-server-manager/manager/src/api/routes.go:115 +0x271
net/http.HandlerFunc.ServeHTTP(0xc000248fa0, 0x953c60, 0xc00015cee0, 0xc0007a3e00)
        /snap/go/current/src/net/http/server.go:2042 +0x44
github.com/gorilla/mux.(*Router).ServeHTTP(0xc00024c000, 0x953c60, 0xc00015cee0, 0xc0007a3900)
        /home/knox/go/pkg/mod/github.com/gorilla/mux@v1.7.3/mux.go:212 +0xd3
net/http.serverHandler.ServeHTTP(0xc00015c460, 0x953c60, 0xc00015cee0, 0xc0007a3900)
        /snap/go/current/src/net/http/server.go:2843 +0xa3
net/http.(*conn).serve(0xc0000f8000, 0x955020, 0xc00024a040)
        /snap/go/current/src/net/http/server.go:1925 +0x8ad
created by net/http.(*Server).Serve
        /snap/go/current/src/net/http/server.go:2969 +0x36c
knoxfighter commented 3 years ago

Fixed with 8c74efb