From 07e099ad905a0deb3d322128ab13c0b4575acf60 Mon Sep 17 00:00:00 2001 From: Gunjan Datta Date: Tue, 19 Aug 2025 11:49:31 -0400 Subject: [PATCH] Fixed the null exception. --- assets/function-app.ps1 | 2 +- src/ds.ts | 24 ++++++++++++++---------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/assets/function-app.ps1 b/assets/function-app.ps1 index 33674ff..d8f41df 100644 --- a/assets/function-app.ps1 +++ b/assets/function-app.ps1 @@ -285,7 +285,7 @@ if ($item -ne $null) { Write-Host "Removing the key $searchProp from the property bag..."; # Remove the site property - Remove-PnPPropertyBagValue -Key $searchProp; + Remove-PnPPropertyBagValue -Key $searchProp -Force; # Set the output $output = "The property bag $searchProp value was removed."; diff --git a/src/ds.ts b/src/ds.ts index 0a8fc3c..a15979d 100644 --- a/src/ds.ts +++ b/src/ds.ts @@ -179,20 +179,24 @@ export class DataSource { if (isSiteAdmin) { return; } // See if the user is a member - for (let i = 0; i < group.members.results.length; i++) { - if (group.members.results[i].mail == ContextInfo.userEmail) { - // Set the flag - isSiteAdmin = true; - return; + if (group.members) { + for (let i = 0; i < group.members.results.length; i++) { + if (group.members.results[i].mail == ContextInfo.userEmail) { + // Set the flag + isSiteAdmin = true; + return; + } } } // See if the user is a owner - for (let i = 0; i < group.owners.results.length; i++) { - if (group.owners.results[i].mail == ContextInfo.userEmail) { - // Set the flag - isSiteAdmin = true; - return; + if (group.owners) { + for (let i = 0; i < group.owners.results.length; i++) { + if (group.owners.results[i].mail == ContextInfo.userEmail) { + // Set the flag + isSiteAdmin = true; + return; + } } } });