diff options
Diffstat (limited to 'ext/tcltklib/tcltklib.c')
-rw-r--r-- | ext/tcltklib/tcltklib.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/ext/tcltklib/tcltklib.c b/ext/tcltklib/tcltklib.c index 1b59006009..b75af3fc77 100644 --- a/ext/tcltklib/tcltklib.c +++ b/ext/tcltklib/tcltklib.c @@ -565,6 +565,7 @@ ip_toUTF8(self, str, encodename) StringValue(encodename); StringValue(str); encoding = Tcl_GetEncoding(interp, RSTRING(encodename)->ptr); + if (!RSTRING(str)->len) return str; buf = ALLOCA_N(char,strlen(RSTRING(str)->ptr)+1); strcpy(buf, RSTRING(str)->ptr); @@ -598,6 +599,7 @@ ip_fromUTF8(self, str, encodename) StringValue(encodename); StringValue(str); encoding = Tcl_GetEncoding(interp,RSTRING(encodename)->ptr); + if (!RSTRING(str)->len) return str; buf = ALLOCA_N(char,strlen(RSTRING(str)->ptr)+1); strcpy(buf,RSTRING(str)->ptr); |