From 96f9e0e58b3347dabd974e23ec31a3cdec1da9f3 Mon Sep 17 00:00:00 2001 From: Robin Ferch Date: Sun, 22 Jan 2023 20:51:33 +0100 Subject: [PATCH] :bug: fix(api): Fixed crash, when region without an owner is deleted. --- backend/src/controllers/RegionsController.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/controllers/RegionsController.ts b/backend/src/controllers/RegionsController.ts index 5774e1c..51c0674 100644 --- a/backend/src/controllers/RegionsController.ts +++ b/backend/src/controllers/RegionsController.ts @@ -101,7 +101,7 @@ class RegionsController { } }); if (region) { - if (region.owner.ssoId === request.kauth.grant.access_token.content.sub + if (region.owner?.ssoId === request.kauth.grant.access_token.content.sub || request.kauth.grant.access_token.content.realm_access.roles.includes("mapadmin")) { await this.core.getPrisma().region.delete({ where: {