File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -1323,7 +1323,11 @@ diff_match_patch.prototype.diff_toDelta = function(diffs) {
13231323 for ( var x = 0 ; x < diffs . length ; x ++ ) {
13241324 switch ( diffs [ x ] [ 0 ] ) {
13251325 case DIFF_INSERT :
1326- text [ x ] = '+' + encodeURI ( diffs [ x ] [ 1 ] ) ;
1326+ try {
1327+ text [ x ] = '+' + encodeURI ( diffs [ x ] [ 1 ] ) ;
1328+ } catch ( ex ) {
1329+ text [ x ] = '+' + diffs [ x ] [ 1 ] ;
1330+ }
13271331 break ;
13281332 case DIFF_DELETE :
13291333 text [ x ] = '-' + diffs [ x ] [ 1 ] . length ;
@@ -2179,7 +2183,11 @@ diff_match_patch.patch_obj.prototype.toString = function() {
21792183 op = ' ' ;
21802184 break ;
21812185 }
2182- text [ x + 1 ] = op + encodeURI ( this . diffs [ x ] [ 1 ] ) + '\n' ;
2186+ try {
2187+ text [ x + 1 ] = op + encodeURI ( this . diffs [ x ] [ 1 ] ) + '\n' ;
2188+ } catch ( ex ) {
2189+ text [ x + 1 ] = op + this . diffs [ x ] [ 1 ] + '\n' ;
2190+ }
21832191 }
21842192 return text . join ( '' ) . replace ( / % 2 0 / g, ' ' ) ;
21852193} ;
You can’t perform that action at this time.
0 commit comments