Fix crash in conf/etc. with empty optional values

This commit is contained in:
Bryan Ashby
2023-12-23 18:09:32 -07:00
parent 6aa0c8679f
commit 223b7b2ed6
5 changed files with 12 additions and 1 deletions

View File

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

View File

@@ -45,6 +45,10 @@ const SIMPLE_ELITE_MAP = {
}; };
function stylizeString(s, style) { function stylizeString(s, style) {
if (!s) {
return '';
}
var len = s.length; var len = s.length;
var c; var c;
var i; var i;

View File

@@ -153,7 +153,11 @@ TextView.prototype.setText = function (text, redraw) {
if (!_.isString(text)) { if (!_.isString(text)) {
// allow |text| to be numbers/etc. // allow |text| to be numbers/etc.
text = text.toString(); if (_.isUndefined(text) || null === text) {
text = '';
} else {
text = text.toString();
}
} }
const formatObj = getPredefinedMCIFormatObject(this.client, text); const formatObj = getPredefinedMCIFormatObject(this.client, text);