--- rxvt-unicode/src/rxvtperl.xs 2021/07/24 11:58:27 1.253 +++ rxvt-unicode/src/rxvtperl.xs 2021/11/21 15:15:02 1.254 @@ -1376,6 +1376,9 @@ rxvt_term::locale_encode (SV *str) CODE: { + if (!SvOK (str)) + XSRETURN_UNDEF; + wchar_t *wstr = sv2wcs (str); rxvt_push_locale (THIS->locale); @@ -1394,6 +1397,9 @@ rxvt_term::locale_decode (SV *octets) CODE: { + if (!SvOK (octets)) + XSRETURN_UNDEF; + STRLEN len; char *data = SvPVbyte (octets, len);