diff --git a/src/chrome/BugReporterDialog.tsx b/src/chrome/BugReporterDialog.tsx index 5551c9568..d0b6f7bba 100644 --- a/src/chrome/BugReporterDialog.tsx +++ b/src/chrome/BugReporterDialog.tsx @@ -116,8 +116,8 @@ class BugReporterDialog extends Component { error: null, }; - titleRef: HTMLElement; - descriptionRef: HTMLElement; + titleRef?: HTMLElement; + descriptionRef?: HTMLElement; onDescriptionChange = (e: React.ChangeEvent) => { this.setState({description: e.target.value}); @@ -134,14 +134,18 @@ class BugReporterDialog extends Component { this.setState({ error: 'Title required.', }); - this.titleRef.focus(); + if (this.titleRef) { + this.titleRef.focus(); + } return; } if (!description) { this.setState({ error: 'Description required.', }); - this.descriptionRef.focus(); + if (this.descriptionRef) { + this.descriptionRef.focus(); + } return; } @@ -310,7 +314,8 @@ export default connect( plugins: {devicePlugins, clientPlugins}, connections: {selectedPlugin}, }) => ({ - activePlugin: - devicePlugins.get(selectedPlugin) || clientPlugins.get(selectedPlugin), + activePlugin: selectedPlugin + ? devicePlugins.get(selectedPlugin) || clientPlugins.get(selectedPlugin) + : null, }), )(BugReporterDialog);