Skip to content

Commit aa27f33

Browse files
committed
Handle null items in standards template arrays
Added checks to skip null items when processing IntuneTemplate and ConditionalAccessTemplate arrays. Also updated template tag value access to use optional chaining for robustness.
1 parent 37d28c6 commit aa27f33

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎src/pages/tenant/manage/applied-standards.js‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ const Page = () => {
145145
Object.entries(selectedTemplate.standards).forEach(([standardKey, standardConfig]) => {
146146
if (standardKey === "IntuneTemplate" && Array.isArray(standardConfig)) {
147147
standardConfig.forEach((templateItem, index) => {
148+
if (!templateItem) return; // Skip null items
148149
console.log("Processing IntuneTemplate item:", templateItem);
149150
if (
150151
templateItem["TemplateList-Tags"]?.value &&
@@ -214,7 +215,7 @@ const Page = () => {
214215
standardId,
215216
standardName: `Intune Template: ${
216217
expandedTemplate.displayName || expandedTemplate.name || itemTemplateId
217-
} (via ${templateItem["TemplateList-Tags"].value})`,
218+
} (via ${templateItem["TemplateList-Tags"]?.value})`,
218219
currentTenantValue:
219220
standardObject !== undefined
220221
? {
@@ -367,6 +368,7 @@ const Page = () => {
367368
) {
368369
// Process each ConditionalAccessTemplate item separately
369370
standardConfig.forEach((templateItem, index) => {
371+
if (!templateItem) return; // Skip null items
370372
// Check if this item has TemplateList-Tags and expand them
371373
if (
372374
templateItem["TemplateList-Tags"]?.value &&
@@ -423,7 +425,7 @@ const Page = () => {
423425
standardId,
424426
standardName: `Conditional Access Template: ${
425427
expandedTemplate.displayName || expandedTemplate.name || itemTemplateId
426-
} (via ${templateItem["TemplateList-Tags"].value})`,
428+
} (via ${templateItem["TemplateList-Tags"]?.value})`,
427429
currentTenantValue:
428430
standardObject !== undefined
429431
? {

0 commit comments

Comments
 (0)