From 08666db5a3301ed64808d3a7759d8d8ae12f9520 Mon Sep 17 00:00:00 2001 From: John Castrillon <Jcastrillon087@gmail.com> Date: Tue, 11 Dec 2018 14:29:05 -0500 Subject: [PATCH] add null check for children and extract (#26) * add null check for children and extract * update null check for children and extract --- src/meta_tags.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/meta_tags.js b/src/meta_tags.js index c217705..6e847b5 100644 --- a/src/meta_tags.js +++ b/src/meta_tags.js @@ -25,15 +25,19 @@ class MetaTags extends Component { } extractChildren() { const {extract} = this.context; + const {children} = this.props; + + if(!children) { + return; + } if (extract) { - extract(this.props.children); + extract(children); } } handleChildrens() { const {children} = this.props; - - if (this.context.extract){ + if (this.context.extract || !children){ return; } -- GitLab