From 0bce0d45c8708165a0f481d40e0a32ec343bfd24 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Thu, 27 Jun 2024 00:22:47 +0800 Subject: [PATCH] :ambulance: Fix nil pointer panic --- .idea/workspace.xml | 6 +++--- pkg/internal/server/api/statuses_api.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 7780eed..0c27140 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -4,7 +4,7 @@ - @@ -177,7 +176,8 @@ - true diff --git a/pkg/internal/server/api/statuses_api.go b/pkg/internal/server/api/statuses_api.go index 82ea585..bb6bb61 100644 --- a/pkg/internal/server/api/statuses_api.go +++ b/pkg/internal/server/api/statuses_api.go @@ -37,10 +37,10 @@ func getStatus(c *fiber.Ctx) error { } func getMyselfStatus(c *fiber.Ctx) error { - user := c.Locals("user").(models.Account) if err := exts.EnsureAuthenticated(c); err != nil { return err } + user := c.Locals("user").(models.Account) status, err := services.GetStatus(user.ID) disturbable := services.GetStatusDisturbable(user.ID) == nil