From 223b7b2ed622017c0c1da4cc974966c60aeb7bc4 Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Sat, 23 Dec 2023 18:09:32 -0700 Subject: [PATCH] Fix crash in conf/etc. with empty optional values --- art/themes/luciano_blocktronics/CONFSCR.ANS | Bin 2556 -> 3205 bytes art/themes/luciano_blocktronics/NUA.ANS | Bin 2609 -> 3029 bytes core/color_codes.js | 3 +++ core/string_util.js | 4 ++++ core/text_view.js | 6 +++++- 5 files changed, 12 insertions(+), 1 deletion(-) diff --git a/art/themes/luciano_blocktronics/CONFSCR.ANS b/art/themes/luciano_blocktronics/CONFSCR.ANS index e3db0cbb04fc67a019784ec9991e2906dfa68410..809adf6e39c69e208ee3663d5184bf6e398488eb 100644 GIT binary patch literal 3205 zcmb_e%Wl&^6ivmh;sX$oz?Vj-B>JX!e8Z)xL;(rYH)`wlBJaIKo4~k9d9;nLNjU2>gbI zV!{D!kk|pO6ciZJ6fc#4%5~ictZd0Cap6`F4m@0d;?0&CLx)K0Z}##bTOX^qBrm0> z34SUGj~;c6q%?5WEuJ{LrL^HdAUg&ECepCx=9BGT? z@{pHW0+9;Ms09!pI)}iuY88$0!X}riyaFnGqcAxV?*{Cz5-O0th zgo$RYZ9TV`U~zrpcm?!zN8fPyxVk~%*H_fQfPfo85}`2Y45(sZ)x$)Vb0r8GB=7F5 zL6(QpXBQyQgA?;ONU|}Ex{8ue88kD6x}NaRJP2tQYnK2j79D*;CNP^lGDhB zJpD&XVv^A@B@N912KW(~%klg&yIxb!KB0G7Ejz97mOr?Gfjx6RO1=fhUp{|2J#lN+ z!<{H1ZDi8JBc>EMPV?+`8BAu`^_AtNs2iM!;!c@%3eqfP)pvS9?tZaHJu}Z%!SC^6 zVeL53dH57}O(#jaA(rfoC!(1Hno%6?nIE&8<@9R2%xd1Sd!{o?A_nHs!}SzkW6xav znonjo2KN!aOi@tR6~e1)3F5{BvIJ?;of!Fu@Bv$7x0adY)D4bbto$%m5cc_es88d` zWOlu10!Y&LN(`gN%MtrC(db1XZOnenXYASm%9?P*?&&&jK4Yu!cf3e~(?tsZhN zN&8Bm|A@ebWdMgpQ?Dg2vl|mkv)Rw-l20FAifEt@oQ6jf2<*5wWHXUP_bjKGaScd# z8YFFwj$$F5(eNW<@mTYWcl6Agx8&wVmQH#Wg$+8MI#nU>vi#Glw1I+V*?2v%TR2S+ zQ$0it7~7`U?@l_5sO|CDqK}zAs-xSoKd()<^WZk9Y2*(jzLof5(Z9G_jkjUd=2ZYN z04Ip}D2C?s=(Ky}hrkS1rC?oE{B>?8 zsjluBuYu$gAG|v={iv$$>D?VA{Z7))dwyqkly;AIM|t7vx^~WC-On>D9G6&kGGA4A zzykk?7aRC;nf5z{nez-5JZccC!a`#)th!WqN91qM6^nZmO3ulApk1Vq%fHw74-S%F@KW!dSZvGaT!IXrw=Ep^)l_&{kEA zrTIjKHPc}Kk5Ys%!W@iI26;mjLC`p}&a7XiE6YcZ{4r)av6{wSoPezd{T5IECapn-z?d`2;5z7^0^ejd%bY+@JFR1z)8F{o^f0R4 zy?-(G-ub5teObiYiEF{EaOQUebBaO|4+BU(y=_SN=5sEoNwf3z?C|1vkR;NE|LK<{X*W&M^!KZ+ Yt?livTW_}bdwqH|bl*=7brt{r0CVjZ$^ZZW diff --git a/art/themes/luciano_blocktronics/NUA.ANS b/art/themes/luciano_blocktronics/NUA.ANS index b57cc0568049fe3ecf940bd6d7e42f5c9697b4a7..4830d76f67bd62fe50d3989b111c89acc28f7979 100644 GIT binary patch literal 3029 zcmbVOO;6iE5Dn@rz4uTqz96-yIyQ3J<`f{RkO)O3w5m9{G%1nTP$g9Gvk-sBmi#|B zpuYLo_1eL%QXjJM?#!F_-i)1WpNFQ~?FQ9r`#erep6A%zKJN|U2sZ)W;(j+WS%w7> z_zVrjgab;D*a4m76d2ML9~FSg^xO!nq-0b$cP9u39xgy}vQcUb9ip(G?A1fHK2C8- zT`Er-d{+=2-Rc=hd4{v5c;akIVZ(tyb_@heq~Xl%DFOCEl{gE@0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0}nRRAms{l2!)M|Oielw$`cz0(Jtc50f z5rzG@549Aw6&eI(f?uha*T{m^&%Lg>>hJ0%6$rS?(50DS^;p`Vvf^qdfPBC$ATS{c z?4`k*$A^l|8W1PoyS=rw*`j7Qz|;i;a?9Qp1VOl*)G{!2r%an!t0*+F??vD(5|hg$ z@itfSo!Ed6sz~fEFp3E8{EPsHW}UiNj3;w7_pBu`dGU1;+l#OU zBe_%f(1L7gerqGFCd)-(CM-p0?(aE?+0920mUN_Ok>*LsmQ^*y3>dg__nu#-ei&^w zIw}e(N_pKNG9BwQe9>O#=Z*liQ`z`%eYCien zvvfR%c~=2oY}V(OdKRnI&D9bVxJcSuEcqV0=A%8ETjjGdL3XBnH7>4aR}e|d?6m1= z0F2GtW9zw?&X&|wbel`h^%H5gP<&io(?(AEg=#BZW%b z2jq!AYT#o6B%t=7)YY3o&s QpO;7b!{E!ufy~_RKLO-3CIA2c diff --git a/core/color_codes.js b/core/color_codes.js index 5c81f3ec1..9c3e4192d 100644 --- a/core/color_codes.js +++ b/core/color_codes.js @@ -98,6 +98,9 @@ function ansiSgrFromCnetStyleColorCode(cc) { } function renegadeToAnsi(s, client) { + if (!s) { + return ''; + } if (-1 == s.indexOf('|')) { return s; // no pipe codes present } diff --git a/core/string_util.js b/core/string_util.js index 3f78b37dd..5d053bc18 100644 --- a/core/string_util.js +++ b/core/string_util.js @@ -45,6 +45,10 @@ const SIMPLE_ELITE_MAP = { }; function stylizeString(s, style) { + if (!s) { + return ''; + } + var len = s.length; var c; var i; diff --git a/core/text_view.js b/core/text_view.js index 2cb19040f..b41c192e8 100644 --- a/core/text_view.js +++ b/core/text_view.js @@ -153,7 +153,11 @@ TextView.prototype.setText = function (text, redraw) { if (!_.isString(text)) { // 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);