fixed nil pointer dereferece

closes #128
This commit is contained in:
2024-01-12 10:55:29 +01:00
parent 8aeffb8d9f
commit 3d9a7e9810
5 changed files with 17 additions and 7 deletions

View File

@@ -41,7 +41,6 @@ type serverConfig struct {
func RunBlocking(host string, port int, frontend fs.FS, dbPath string) {
var mdb internal.MemoryDB
mdb.Restore()
logger := slog.New(
slog.NewTextHandler(
@@ -50,6 +49,8 @@ func RunBlocking(host string, port int, frontend fs.FS, dbPath string) {
),
)
mdb.Restore(logger)
db, err := sql.Open("sqlite", dbPath)
if err != nil {
logger.Error("failed to open database", slog.String("err", err.Error()))