From 43a570da7c5b98d63a5b9e55d18a88ed21c6f680 Mon Sep 17 00:00:00 2001 From: Amumu Date: Wed, 20 Jun 2018 19:57:29 +0800 Subject: [PATCH] For robustness close #1661 --- src/components/GlobalHeader/index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/GlobalHeader/index.js b/src/components/GlobalHeader/index.js index 10aea499..0f405f7b 100644 --- a/src/components/GlobalHeader/index.js +++ b/src/components/GlobalHeader/index.js @@ -13,8 +13,8 @@ export default class GlobalHeader extends PureComponent { this.triggerResizeEvent.cancel(); } getNoticeData() { - const { notices = [] } = this.props; - if (notices.length === 0) { + const { notices} = this.props; + if (notices == null || notices.length === 0) { return {}; } const newNotices = notices.map(notice => { @@ -66,6 +66,9 @@ export default class GlobalHeader extends PureComponent { onMenuClick, onNoticeClear, } = this.props; + if (currentUser == null) { + currentUser = {} + } const menu = ( -- GitLab