summaryrefslogtreecommitdiffstats
path: root/ext/tcltklib/tcltklib.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-08-30 10:42:09 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-08-30 10:42:09 +0000
commitf0b2c123c4736660211a1bff68bc45f0a524d5e9 (patch)
tree313b9622abf265d1e91ca27f9b8becaae738ce6f /ext/tcltklib/tcltklib.c
parentc36c385d43b74cb6db352d0e42ed0b4a7f620442 (diff)
downloadruby-f0b2c123c4736660211a1bff68bc45f0a524d5e9.tar.gz
ruby-f0b2c123c4736660211a1bff68bc45f0a524d5e9.tar.xz
ruby-f0b2c123c4736660211a1bff68bc45f0a524d5e9.zip
* ext/Win32API/Win32API.c (Win32API_Call): RSTRING()->ptr may be
NULL. * ext/nkf/nkf.c (rb_nkf_guess): ditto. * ext/readline/readline.c (readline_s_set_completion_append_character): ditto. * ext/socket/socket.c (sock_s_getaddrinfo, sock_s_getnameinfo): ditto. * ext/tcltklib/tcltklib.c (ip_toUTF8, ip_fromUTF8): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@2768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tcltklib/tcltklib.c')
-rw-r--r--ext/tcltklib/tcltklib.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/ext/tcltklib/tcltklib.c b/ext/tcltklib/tcltklib.c
index 1b5900600..b75af3fc7 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);