diff --git a/src/components/adslot-ui/Tabs/index.jsx b/src/components/adslot-ui/Tabs/index.jsx
old mode 100644
new mode 100755
index 65218dd39..3d09c70b1
--- a/src/components/adslot-ui/Tabs/index.jsx
+++ b/src/components/adslot-ui/Tabs/index.jsx
@@ -44,7 +44,7 @@ class Tabs extends React.Component {
const tabs = [];
const content = React.Children.map(children, child => {
- if (_.isFunction(child.type) && child.type.innerName === Tab.innerName) {
+ if (!_.isEmpty(child) && _.isFunction(child.type) && child.type.innerName === Tab.innerName) {
const tab = React.cloneElement(child, {
show: this.activeKey === child.props.eventKey,
});
diff --git a/src/components/adslot-ui/Tabs/index.spec.jsx b/src/components/adslot-ui/Tabs/index.spec.jsx
old mode 100644
new mode 100755
index d7bf7361b..e3d268795
--- a/src/components/adslot-ui/Tabs/index.spec.jsx
+++ b/src/components/adslot-ui/Tabs/index.spec.jsx
@@ -1,6 +1,6 @@
import React from 'react';
import _ from 'lodash';
-import { shallow } from 'enzyme';
+import { shallow, mount } from 'enzyme';
import sinon from 'sinon';
import Tabs from '.';
import Tab from '../Tab';
@@ -71,4 +71,16 @@ describe('', () => {
links.last().simulate('click', { preventDefault: _.noop });
expect(spy.callCount).to.equal(1);
});
+
+ it('should not crash when child returns null', () => {
+ const wrapper = mount(
+
+
+ Tab1
+
+ {null}
+
+ );
+ expect(wrapper.find(Tabs).length).to.equal(1);
+ });
});