Fix possible BBS crash on undefined text

This commit is contained in:
Nathan Byrd 2023-01-27 16:27:33 -06:00
parent 8dd28e3091
commit 4f6891a668
1 changed files with 5 additions and 0 deletions

View File

@ -151,6 +151,11 @@ 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;
// Don't bomb if text isn't defined, just treat as blank instead.
if (_.isUndefined(text)) {
text = '';
}
if (!_.isString(text)) { if (!_.isString(text)) {
// allow |text| to be numbers/etc. // allow |text| to be numbers/etc.
text = text.toString(); text = text.toString();