Skip to content

Commit 29b9bfb

Browse files
committed
systemd: guard against currentIdentifiers being undefined
The initial state of `currentIdentifiers` is undefined, while unlikely to be triggered as prependEntries() is called after some promises are done. Adding a link to the logs page from cockpit-podman triggered and clicking it in our tests triggered: ``` TypeError: Cannot read properties of undefined (reading 'includes')"] ```
1 parent 09ebd7d commit 29b9bfb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/systemd/logsJournal.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ export class JournalBox extends React.Component {
168168
const serviceTag = entries[i].SYSLOG_IDENTIFIER;
169169
this.renderer.prepend(entries[i]);
170170
// Only update if the service is not yet known
171-
if (serviceTag && !this.props.currentIdentifiers.includes(serviceTag))
171+
if (serviceTag && !(this.props.currentIdentifiers || []).includes(serviceTag))
172172
// Due to asynchronous nature it needs to be checked whether this
173173
// identifier is not yet defined. The previous check could be omitted
174174
// and only this one used but let's try to trigger as few updates as possible

0 commit comments

Comments
 (0)