From b715395302f0134112bf8fa356f8e56e6e97fd00 Mon Sep 17 00:00:00 2001 From: "Alex S." Date: Thu, 16 Nov 2023 18:51:44 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20bug:=20Server=20no=20longer=20cr?= =?UTF-8?q?ashes=20if=20CONFSCR=20has=20null=20values?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/color_codes.js | 2 +- core/string_util.js | 8 +++++++- core/text_view.js | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/core/color_codes.js b/core/color_codes.js index 5c81f3ec..c7eb4235 100644 --- a/core/color_codes.js +++ b/core/color_codes.js @@ -98,7 +98,7 @@ function ansiSgrFromCnetStyleColorCode(cc) { } function renegadeToAnsi(s, client) { - if (-1 == s.indexOf('|')) { + if (s == null || -1 == s.indexOf('|')) { return s; // no pipe codes present } diff --git a/core/string_util.js b/core/string_util.js index 3f78b37d..f36aa49b 100644 --- a/core/string_util.js +++ b/core/string_util.js @@ -45,6 +45,9 @@ const SIMPLE_ELITE_MAP = { }; function stylizeString(s, style) { + if (s == null) { + return s; + } var len = s.length; var c; var i; @@ -214,6 +217,9 @@ function containsNonLatinCodepoints(s) { } function stripAllLineFeeds(s) { + if (s == null) { + return s; + } 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) { // shortcut for empty strings - if (0 === str.length) { + if (str == null || 0 === str.length) { return str; } diff --git a/core/text_view.js b/core/text_view.js index 2cb19040..f54f31f8 100644 --- a/core/text_view.js +++ b/core/text_view.js @@ -151,7 +151,7 @@ TextView.prototype.getData = function () { TextView.prototype.setText = function (text, redraw) { redraw = _.isBoolean(redraw) ? redraw : true; - if (!_.isString(text)) { + if (text != null && !_.isString(text)) { // allow |text| to be numbers/etc. text = text.toString(); }