Skip to content

Commit

Permalink
apply suggestion: defensive nullish check
Browse files Browse the repository at this point in the history
Co-Authored-By: Jordan Harband <ljharb@gmail.com>
  • Loading branch information
golopot and ljharb committed Jul 13, 2019
1 parent 2c5b4a1 commit 75e9990
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rules/jsx-no-useless-fragment.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ module.exports = {
* @param {JSXElement|JSXFragment} node
*/
function hasLessThanTwoChildren(node) {
if (node.children.length < 2) {
if (!node || !node.children || node.children.length < 2) {
return true;
}

Expand Down

0 comments on commit 75e9990

Please sign in to comment.