Skip to content

Commit bde89f2

Browse files
committed
check for empty roles list
1 parent 8fab50b commit bde89f2

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

frontend/web/components/pages/EnvironmentSettingsPage.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ const EnvironmentSettingsPage = class extends Component {
7676
},
7777
{ forceRefetch: true },
7878
).then((res) => {
79-
const matchingItems = roles.data.results.filter((item1) =>
79+
const matchingItems = roles?.data?.results?.filter((item1) =>
8080
res.data.results.some((item2) => item2.role === item1.id),
8181
)
8282
this.setState({ roles: matchingItems })

frontend/web/components/pages/ProjectSettingsPage.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ const ProjectSettingsPage = class extends Component {
6565
{
6666
organisation_id: AccountStore.getOrganisation().id,
6767
project_id: this.props.match.params.projectId,
68-
role_id: roles.data.results[0].id,
68+
role_id: roles?.data?.results[0]?.id,
6969
},
7070
{ forceRefetch: true },
7171
).then((res) => {
72-
const matchingItems = roles.data.results.filter((item1) =>
72+
const matchingItems = roles?.data?.results?.filter((item1) =>
7373
res.data.results.some((item2) => item2.role === item1.id),
7474
)
7575
this.setState({ roles: matchingItems })

0 commit comments

Comments
 (0)