Fixed an issue where not being in a group would cause an error

This commit is contained in:
Hipposgrumm 2025-12-28 22:20:26 -07:00 committed by Spirtix
parent 1f4699a382
commit 7a3f84b49e

View File

@ -300,6 +300,7 @@ public class GroupController : Controller {
if (request.ForUserID != null) {
Viking? target = ctx.Vikings.FirstOrDefault(v => request.ForUserID.ToUpper() == v.Uid.ToString());
if (target == null) return Ok(new GetGroupsResult { Success = false });
if (target.GroupMembership?.Group == null) return Ok(new GetGroupsResult { Success = true });
groups = [target.GroupMembership.Group];
} else {
groups = groups.Where(g => g.Type == GroupType.Public || g.Type == GroupType.MembersOnly);