Skip to content

Commit eb3d392

Browse files
author
Martin Kinkelin
committed
Fix potential exception after unmounting
handleBlur() calls deferFocusInput() if the date picker is open. deferFocusInput() schedules a later setFocus() call, which didn't make sure the input element is still mounted before focusing it, yielding an unhandled exception.
1 parent 2e10682 commit eb3d392

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ export default class DatePicker extends React.Component {
220220
};
221221

222222
setFocus = () => {
223-
if (this.input.focus) {
223+
if (this.input && this.input.focus) {
224224
this.input.focus();
225225
}
226226
};

0 commit comments

Comments
 (0)