🚑 Fix nil pointer panic

This commit is contained in:
LittleSheep 2024-06-27 00:22:47 +08:00
parent 203465f0bb
commit 0bce0d45c8
2 changed files with 4 additions and 4 deletions

6
.idea/workspace.xml generated
View File

@ -4,7 +4,7 @@
<option name="autoReloadType" value="ALL" />
</component>
<component name="ChangeListManager">
<list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":bug: Fix ws security blocked">
<list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":bug: Invisible status is visible to others">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/internal/server/api/statuses_api.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/server/api/statuses_api.go" afterDir="false" />
</list>
@ -152,7 +152,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value=":ambulance: Fix query services too much 429" />
<MESSAGE value=":ambulance: Fix nil map panic" />
<MESSAGE value=":recycle: Update the sign in web page to the latest API" />
<MESSAGE value=":wastebasket: Remove the personal page" />
@ -177,7 +176,8 @@
<MESSAGE value=":sparkles: Get myself current status API" />
<MESSAGE value=":bug: Fix miscall function" />
<MESSAGE value=":bug: Fix ws security blocked" />
<option name="LAST_COMMIT_MESSAGE" value=":bug: Fix ws security blocked" />
<MESSAGE value=":bug: Invisible status is visible to others" />
<option name="LAST_COMMIT_MESSAGE" value=":bug: Invisible status is visible to others" />
</component>
<component name="VgoProject">
<settings-migrated>true</settings-migrated>

View File

@ -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