Skip to content

Commit

Permalink
Fix errata output error caused by race condition
Browse files Browse the repository at this point in the history
`this.platforms` is a computed value and may be empty when
`platformName()` is executed, which can result in accessing a
non-existent `label` property.

This fix unsure that matched platform exists before accessing it,
preventing UI breakage.

Fixes: AlmaLinux/build-system#430
  • Loading branch information
pastalian committed Feb 12, 2025
1 parent 7abc72f commit 4f27ce8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/components/ErrataInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,8 @@
return description && description !== this.advisory.original_description
},
platformName(id) {
return this.platforms.find((platform) => platform.value == id).label
const platform = this.platforms.find((platform) => platform.value == id)
return platform ? platform.label : ''
},
cveRows(refs) {
return refs.filter((ref) => ref.cve)
Expand Down
3 changes: 2 additions & 1 deletion src/pages/ErrataFeed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,8 @@
return advisory.title ? advisory.title : advisory.original_title
},
platformName(id) {
return this.platforms.find((platform) => platform.value == id).label
const platform = this.platforms.find((platform) => platform.value == id)
return platform ? platform.label : ''
},
},
components: {
Expand Down

0 comments on commit 4f27ce8

Please sign in to comment.