Skip to content

Commit bcedbba

Browse files
martinpittKKoukiou
authored andcommitted
lib: Drop unnecessary optional chaining
DialogFooter already accesses other fields of `action`, and thus it can't be undefined. apply_modal_dialog() already assumes that `event` is defined, as it calls `.preventDefault()` on it (which would crashs if undefined). Spotted by Coverity.
1 parent 24a2e28 commit bcedbba

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/lib/cockpit-components-dialog.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ class DialogFooter extends React.Component {
169169
variant={ variant }
170170
isDanger={ action.danger }
171171
onClick={ this.action_click.bind(this, action.clicked) }
172-
isDisabled={ actions_disabled || action?.disabled }
172+
isDisabled={ actions_disabled || action.disabled }
173173
>{ caption }</Button>
174174
);
175175
});
@@ -344,7 +344,7 @@ export function show_modal_dialog(props, footerProps) {
344344
}
345345

346346
export function apply_modal_dialog(event) {
347-
const dialog = event?.target?.closest("[role=dialog]");
347+
const dialog = event.target?.closest("[role=dialog]");
348348
const button = dialog?.querySelector("button.apply");
349349

350350
if (button) {

0 commit comments

Comments
 (0)