Add missing null checks to CollectionController

This commit is contained in:
Slendy 2022-11-10 22:20:28 -06:00
parent f1a6eb48b1
commit e5cafb1e02
No known key found for this signature in database
GPG key ID: 7288D68361B91428

View file

@ -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();