@@ -140,7 +140,7 @@ class InlineDiffView extends BaseDiffView {
140140
141141 selectEditor ( editor ) {
142142 if ( editor == this . activeEditor ) {
143- this . otherEditor . selection . clearSelection ( ) ;
143+ this . otherEditor . selection && this . otherEditor . selection . clearSelection ( ) ;
144144 this . activeEditor . textInput . setHost ( this . activeEditor ) ;
145145 this . activeEditor . setStyle ( "ace_diff_other" , false ) ;
146146 this . cursorLayer . element . remove ( ) ;
@@ -153,7 +153,7 @@ class InlineDiffView extends BaseDiffView {
153153 this . activeEditor . renderer . $markerBack . element . classList . remove ( "ace_hidden_marker-layer" ) ;
154154 this . removeBracketHighlight ( this . otherEditor ) ;
155155 } else {
156- this . activeEditor . selection . clearSelection ( ) ;
156+ this . activeEditor . selection && this . activeEditor . selection . clearSelection ( ) ;
157157 this . activeEditor . textInput . setHost ( this . otherEditor ) ;
158158 this . activeEditor . setStyle ( "ace_diff_other" ) ;
159159 this . activeEditor . renderer . $cursorLayer . element . parentNode . appendChild (
@@ -174,7 +174,7 @@ class InlineDiffView extends BaseDiffView {
174174
175175 removeBracketHighlight ( editor ) {
176176 var session = editor . session ;
177- if ( session . $bracketHighlight ) {
177+ if ( session && session . $bracketHighlight ) {
178178 session . $bracketHighlight . markerIds . forEach ( function ( id ) {
179179 session . removeMarker ( id ) ;
180180 } ) ;
@@ -312,6 +312,7 @@ class InlineDiffView extends BaseDiffView {
312312 }
313313
314314 $detachSessionHandlers ( editor , marker ) {
315+ if ( ! editor . session ) return ;
315316 editor . session . removeMarker ( marker . id ) ;
316317 editor . selection . off ( "changeCursor" , this . onSelect ) ;
317318 editor . selection . off ( "changeSelection" , this . onSelect ) ;
0 commit comments