From e7509af2b2fad6ab23ea07e6e46e88a4ee0d03f1 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Wed, 25 Jul 2012 12:29:16 -0700 Subject: adding null check for currentDocument to prevent error Signed-off-by: Ananya Sen --- .../ui/code-editor-view-options.reel/code-editor-view-options.js | 2 +- js/components/layout/document-bar.reel/document-bar.js | 6 ------ js/controllers/styles-controller.js | 2 +- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js b/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js index 70d033fb..2ca6118b 100644 --- a/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js +++ b/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js @@ -53,7 +53,7 @@ exports.CodeEditorViewOptions = Montage.create(Component, { if(!value || (this._currentDocument.currentView === "design")) { this.visible = false; - } else if(this._currentDocument.currentView === "code") { + } else if(this._currentDocument && this._currentDocument.currentView === "code") { if(this._currentDocument.model.views.design){//code view of design document this.application.ninja.editorViewOptions.visible = false; diff --git a/js/components/layout/document-bar.reel/document-bar.js b/js/components/layout/document-bar.reel/document-bar.js index c1d77668..bf84c652 100755 --- a/js/components/layout/document-bar.reel/document-bar.js +++ b/js/components/layout/document-bar.reel/document-bar.js @@ -217,9 +217,6 @@ exports.DocumentBar = Montage.create(Component, { value: function () { // this.showView('design', this.renderDesignView, this.btnDesign, this.btnCode); - - //todo - temp - this.application.ninja.documentBar.codeEditorControls.visible = false; } }, //////////////////////////////////////////////////////////////////// @@ -228,9 +225,6 @@ exports.DocumentBar = Montage.create(Component, { value: function () { // this.showView('code', this.renderCodeView, this.btnCode, this.btnDesign); - - //todo - temp - this.application.ninja.documentBar.codeEditorControls.visible = true; } }, //////////////////////////////////////////////////////////////////// diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js index 0e1df1e9..e95c6614 100755 --- a/js/controllers/styles-controller.js +++ b/js/controllers/styles-controller.js @@ -131,7 +131,7 @@ var stylesController = exports.StylesController = Montage.create(Component, { handleChange: { value: function(notification) { if(notification.currentPropertyPath === "model.currentViewIdentifier") { - if(this.currentDocument.model.currentView.identifier === "design") { + if(this.currentDocument && this.currentDocument.model.currentView.identifier === "design") { ///// Stage stylesheet should always be found this._stageStylesheet = this.getSheetFromElement(this.CONST.STAGE_SHEET_ID); // Returns null if sheet not found (as in non-ninja projects) -- cgit v1.2.3