瀏覽代碼

null check of currentUser

itizawa 6 年之前
父節點
當前提交
fbe7319f81
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      src/client/js/services/AppContainer.js

+ 4 - 1
src/client/js/services/AppContainer.js

@@ -47,7 +47,10 @@ export default class AppContainer extends Container {
       this.currentUser = JSON.parse(currentUserElem.textContent);
     }
 
-    const userLocaleId = this.currentUser.lang;
+    let userLocaleId;
+    if (this.currentUser != null) {
+      userLocaleId = this.currentUser.lang;
+    }
     this.i18n = i18nFactory(userLocaleId);
 
     this.containerInstances = {};