Skip to content

Commit 2fc7b73

Browse files
authored
Fix/blank page on empty policy groups (#292)
validate null sources and destinations fields
1 parent a9354d3 commit 2fc7b73

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

src/views/Settings.tsx

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -305,17 +305,20 @@ export const Settings = () => {
305305
const createSingleArrayForPolicy: any = [];
306306
policies.map((aControl: any) => {
307307
const cSingleAccessArray = aControl.allGroups ? aControl.allGroups : [];
308-
aControl.rules[0].destinations.forEach((destination: any) => {
309-
if (cSingleAccessArray.indexOf(destination.id) === -1) {
310-
cSingleAccessArray.push(destination.id);
311-
}
312-
});
313-
314-
aControl.rules[0].sources.forEach((source: any) => {
315-
if (cSingleAccessArray.indexOf(source.id) === -1) {
316-
cSingleAccessArray.push(source.id);
317-
}
318-
});
308+
if (aControl.rules[0].destinations) {
309+
aControl.rules[0].destinations.forEach((destination: any) => {
310+
if (cSingleAccessArray.indexOf(destination.id) === -1) {
311+
cSingleAccessArray.push(destination.id);
312+
}
313+
});
314+
}
315+
if (aControl.rules[0].sources) {
316+
aControl.rules[0].sources.forEach((source: any) => {
317+
if (cSingleAccessArray.indexOf(source.id) === -1) {
318+
cSingleAccessArray.push(source.id);
319+
}
320+
});
321+
}
319322

320323
aControl["cSingleAccessArray"] = cSingleAccessArray;
321324
createSingleArrayForPolicy.push(aControl);

0 commit comments

Comments
 (0)