🐛 bug: Server no longer crashes if CONFSCR has null values

This commit is contained in:
Alex S. 2023-11-16 18:51:44 -07:00
parent 6aa0c8679f
commit b715395302
3 changed files with 9 additions and 3 deletions

View File

@ -98,7 +98,7 @@ function ansiSgrFromCnetStyleColorCode(cc) {
} }
function renegadeToAnsi(s, client) { function renegadeToAnsi(s, client) {
if (-1 == s.indexOf('|')) { if (s == null || -1 == s.indexOf('|')) {
return s; // no pipe codes present return s; // no pipe codes present
} }

View File

@ -45,6 +45,9 @@ const SIMPLE_ELITE_MAP = {
}; };
function stylizeString(s, style) { function stylizeString(s, style) {
if (s == null) {
return s;
}
var len = s.length; var len = s.length;
var c; var c;
var i; var i;
@ -214,6 +217,9 @@ function containsNonLatinCodepoints(s) {
} }
function stripAllLineFeeds(s) { function stripAllLineFeeds(s) {
if (s == null) {
return s;
}
return s.replace(/\r?\n|[\r\u2028\u2029]/g, ''); return s.replace(/\r?\n|[\r\u2028\u2029]/g, '');
} }
@ -247,7 +253,7 @@ const ANSI_OR_PIPE_REGEXP = new RegExp(
// //
function renderSubstr(str, start, length) { function renderSubstr(str, start, length) {
// shortcut for empty strings // shortcut for empty strings
if (0 === str.length) { if (str == null || 0 === str.length) {
return str; return str;
} }

View File

@ -151,7 +151,7 @@ TextView.prototype.getData = function () {
TextView.prototype.setText = function (text, redraw) { TextView.prototype.setText = function (text, redraw) {
redraw = _.isBoolean(redraw) ? redraw : true; redraw = _.isBoolean(redraw) ? redraw : true;
if (!_.isString(text)) { if (text != null && !_.isString(text)) {
// allow |text| to be numbers/etc. // allow |text| to be numbers/etc.
text = text.toString(); text = text.toString();
} }