Skip to content

Commit

Permalink
Fix #2491: Dropdown null ref checks (#2492)
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware authored Dec 10, 2021
1 parent e2792ab commit 0fe0b1a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/components/dropdown/Dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,10 @@ export class Dropdown extends Component {
}

checkValidity() {
return this.inputRef.current.checkValidity();
if (this.inputRef.current) {
return this.inputRef.current.checkValidity();
}
return false;
}

isLazy() {
Expand Down Expand Up @@ -845,7 +848,9 @@ export class Dropdown extends Component {
}

this.updateInputField();
this.inputRef.current.selectedIndex = 1;
if (this.inputRef.current) {
this.inputRef.current.selectedIndex = 1;
}
}

componentWillUnmount() {
Expand Down Expand Up @@ -892,7 +897,9 @@ export class Dropdown extends Component {
}

this.updateInputField();
this.inputRef.current.selectedIndex = 1;
if (this.inputRef.current) {
this.inputRef.current.selectedIndex = 1;
}
}

renderHiddenSelect(selectedOption) {
Expand Down

0 comments on commit 0fe0b1a

Please sign in to comment.