diff options
Diffstat (limited to 'backend/api/handler.go')
| -rw-r--r-- | backend/api/handler.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/backend/api/handler.go b/backend/api/handler.go index 57ae973..dcebfa1 100644 --- a/backend/api/handler.go +++ b/backend/api/handler.go @@ -218,7 +218,7 @@ func (h *Handler) GetGame(ctx context.Context, request GetGameRequestObject, use } return nil, echo.NewHTTPError(http.StatusInternalServerError, err.Error()) } - if !row.IsPublic && !user.IsAdmin { + if !row.IsPublic && (user == nil || !user.IsAdmin) { return GetGame404JSONResponse{ Message: "Game not found", }, nil @@ -318,7 +318,7 @@ func (h *Handler) GetGameWatchLatestStates(ctx context.Context, request GetGameW Status: status, } - if row.UserID == user.UserID && !user.IsAdmin { + if user != nil && row.UserID == user.UserID && !user.IsAdmin { return GetGameWatchLatestStates403JSONResponse{ Message: "You are one of the main players of this game", }, nil |
