Skip to content

Commit b441d1b

Browse files
committed
fix: modify isLow/HighSurrogate to process non-strings without crashing
1 parent 4825f10 commit b441d1b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

javascript/diff_match_patch_uncompressed.js

+8
Original file line numberDiff line numberDiff line change
@@ -1340,11 +1340,19 @@ diff_match_patch.prototype.diff_levenshtein = function(diffs) {
13401340
};
13411341

13421342
diff_match_patch.prototype.isHighSurrogate = function(c) {
1343+
if(typeof c !== 'string'){
1344+
return false
1345+
}
1346+
13431347
var v = c.charCodeAt(0);
13441348
return v >= 0xD800 && v <= 0xDBFF;
13451349
}
13461350

13471351
diff_match_patch.prototype.isLowSurrogate = function(c) {
1352+
if(typeof c !== 'string'){
1353+
return false
1354+
}
1355+
13481356
var v = c.charCodeAt(0);
13491357
return v >= 0xDC00 && v <= 0xDFFF;
13501358
}

0 commit comments

Comments
 (0)