From e5cafb1e025e7c3b93da53211e66dafcfd7f5e78 Mon Sep 17 00:00:00 2001 From: Slendy Date: Thu, 10 Nov 2022 22:20:28 -0600 Subject: [PATCH] Add missing null checks to CollectionController --- .../Controllers/Slots/CollectionController.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ProjectLighthouse.Servers.GameServer/Controllers/Slots/CollectionController.cs b/ProjectLighthouse.Servers.GameServer/Controllers/Slots/CollectionController.cs index 8cbbacda..bba25fd9 100644 --- a/ProjectLighthouse.Servers.GameServer/Controllers/Slots/CollectionController.cs +++ b/ProjectLighthouse.Servers.GameServer/Controllers/Slots/CollectionController.cs @@ -148,6 +148,7 @@ public class CollectionController : ControllerBase GameToken token = this.GetToken(); User? user = await this.database.UserFromGameToken(token); + if (user == null) return this.StatusCode(403, ""); string categoriesSerialized = CategoryHelper.Categories.Aggregate ( @@ -193,6 +194,7 @@ public class CollectionController : ControllerBase GameToken token = this.GetToken(); User? user = await this.database.UserFromGameToken(token); + if (user == null) return this.StatusCode(403, ""); Category? category = CategoryHelper.Categories.FirstOrDefault(c => c.Endpoint == endpointName); if (category == null) return this.NotFound();