From 83f85a371a0defe86bfd30dacf5593ba385f2b91 Mon Sep 17 00:00:00 2001 From: Sebastian Blade Date: Fri, 24 Mar 2017 13:10:27 +0800 Subject: [PATCH] Fix button render with null or undefined child. (#5473) * Fix button render with null or undefined child. Fix bug #5472 * Add missing semicolon * Make if statement braced. ...... --- components/button/button.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/button/button.tsx b/components/button/button.tsx index dc2f062a11..2211cad152 100644 --- a/components/button/button.tsx +++ b/components/button/button.tsx @@ -12,6 +12,10 @@ function isString(str) { // Insert one space between two chinese characters automatically. function insertSpace(child) { + // Check the child if is undefined or null. + if (child == null) { + return; + } if (isString(child.type) && isTwoCNChar(child.props.children)) { return React.cloneElement(child, {}, child.props.children.split('').join(' '));