diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-05-05 17:28:45 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-05-05 17:28:45 +0000 |
commit | 10685d4f71e49e6b13d0ec53f54907eb9888fd79 (patch) | |
tree | b121bc07b744da167789e6dc4af51202a8477176 /ext | |
parent | ac5ffe0a19df7f373d699bce8a66f6154ad80182 (diff) |
merge revision(s) 53322,53323: [Backport #11880]
* ext/win32ole/win32ole.c (ole_vstr2wc, ole_variant2val): fix blank
string conversion.
[Bug #11880]
Thanks Akio Tajima for the patch!
string conversion.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@54923 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r-- | ext/win32ole/win32ole.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/ext/win32ole/win32ole.c b/ext/win32ole/win32ole.c index 02ad82b4d4..ac3c2a6a73 100644 --- a/ext/win32ole/win32ole.c +++ b/ext/win32ole/win32ole.c @@ -864,6 +864,9 @@ ole_vstr2wc(VALUE vstr) /* do not type-conversion here to prevent from other arguments * changing (if exist) */ Check_Type(vstr, T_STRING); + if (RSTRING_LEN(vstr) == 0) { + return NULL; + } enc = rb_enc_get(vstr); @@ -1571,10 +1574,16 @@ ole_variant2val(VARIANT *pvar) case VT_BSTR: { - if(V_ISBYREF(pvar)) - obj = ole_wc2vstr(*V_BSTRREF(pvar), FALSE); - else - obj = ole_wc2vstr(V_BSTR(pvar), FALSE); + if(V_ISBYREF(pvar)) { + obj = (SysStringLen(*V_BSTRREF(pvar)) == 0) + ? rb_str_new2("") + : ole_wc2vstr(*V_BSTRREF(pvar), FALSE); + } + else { + obj = (SysStringLen(V_BSTR(pvar)) == 0) + ? rb_str_new2("") + : ole_wc2vstr(V_BSTR(pvar), FALSE); + } break; } |