aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnanya Sen2012-07-25 12:29:16 -0700
committerAnanya Sen2012-07-25 12:29:16 -0700
commite7509af2b2fad6ab23ea07e6e46e88a4ee0d03f1 (patch)
tree8a180716f60bf87073233732753da65711c28732
parentfa2e82cf10aaa4900a462410cbb99b5b0433a1b1 (diff)
downloadninja-e7509af2b2fad6ab23ea07e6e46e88a4ee0d03f1.tar.gz
adding null check for currentDocument to prevent error
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
-rw-r--r--js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js2
-rwxr-xr-xjs/components/layout/document-bar.reel/document-bar.js6
-rwxr-xr-xjs/controllers/styles-controller.js2
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, {
53 53
54 if(!value || (this._currentDocument.currentView === "design")) { 54 if(!value || (this._currentDocument.currentView === "design")) {
55 this.visible = false; 55 this.visible = false;
56 } else if(this._currentDocument.currentView === "code") { 56 } else if(this._currentDocument && this._currentDocument.currentView === "code") {
57 57
58 if(this._currentDocument.model.views.design){//code view of design document 58 if(this._currentDocument.model.views.design){//code view of design document
59 this.application.ninja.editorViewOptions.visible = false; 59 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, {
217 value: function () { 217 value: function () {
218 // 218 //
219 this.showView('design', this.renderDesignView, this.btnDesign, this.btnCode); 219 this.showView('design', this.renderDesignView, this.btnDesign, this.btnCode);
220
221 //todo - temp
222 this.application.ninja.documentBar.codeEditorControls.visible = false;
223 } 220 }
224 }, 221 },
225 //////////////////////////////////////////////////////////////////// 222 ////////////////////////////////////////////////////////////////////
@@ -228,9 +225,6 @@ exports.DocumentBar = Montage.create(Component, {
228 value: function () { 225 value: function () {
229 // 226 //
230 this.showView('code', this.renderCodeView, this.btnCode, this.btnDesign); 227 this.showView('code', this.renderCodeView, this.btnCode, this.btnDesign);
231
232 //todo - temp
233 this.application.ninja.documentBar.codeEditorControls.visible = true;
234 } 228 }
235 }, 229 },
236 //////////////////////////////////////////////////////////////////// 230 ////////////////////////////////////////////////////////////////////
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, {
131 handleChange: { 131 handleChange: {
132 value: function(notification) { 132 value: function(notification) {
133 if(notification.currentPropertyPath === "model.currentViewIdentifier") { 133 if(notification.currentPropertyPath === "model.currentViewIdentifier") {
134 if(this.currentDocument.model.currentView.identifier === "design") { 134 if(this.currentDocument && this.currentDocument.model.currentView.identifier === "design") {
135 ///// Stage stylesheet should always be found 135 ///// Stage stylesheet should always be found
136 this._stageStylesheet = this.getSheetFromElement(this.CONST.STAGE_SHEET_ID); 136 this._stageStylesheet = this.getSheetFromElement(this.CONST.STAGE_SHEET_ID);
137 // Returns null if sheet not found (as in non-ninja projects) 137 // Returns null if sheet not found (as in non-ninja projects)