Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit f43ff63

Browse files
committed
fix(radio-button): Cannot read property 'nodeName' of null
Fixes #10546
1 parent 0d431e0 commit f43ff63

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/components/radioButton/radio-button.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -331,16 +331,17 @@ function mdRadioButtonDirective($mdAria, $mdUtil, $mdTheming) {
331331
}
332332

333333
/**
334-
* Add or remove the `.md-checked` class from the RadioButton (and conditionally its parent).
335-
* Update the `aria-activedescendant` attribute.
334+
* Add or remove the `.md-checked` class from the RadioButton (and conditionally its parent).
335+
* Update the `aria-activedescendant` attribute.
336336
*/
337337
function render() {
338338
var checked = radioGroupController.getViewValue() == attr.value;
339339

340340
if (checked === lastChecked) return;
341341

342-
if (element[0].parentNode.nodeName.toLowerCase() !== 'md-radio-group') {
343-
// If the radioButton is inside a div, then add class so highlighting will work
342+
if (element[0] && element[0].parentNode &&
343+
element[0].parentNode.nodeName.toLowerCase() !== 'md-radio-group') {
344+
// If the radioButton is inside a div, then add class so highlighting will work.
344345
element.parent().toggleClass(CHECKED_CSS, checked);
345346
}
346347

0 commit comments

Comments
 (0)