summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsuke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-29 13:25:02 +0000
committersuke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-29 13:25:02 +0000
commitdb91d29f7cd86849aa2df963f67d8b7202924b0d (patch)
tree947ec4a8782487b1affb9c66f9e547b3383a18fc
parentce4325f3540d238ac7d95a86e2a534f69b027aa7 (diff)
* ext/win32ole/win32ole.c (hash2olerec): ignore WIN32OLE_RECORD
instance variable if the variable is nil. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--ext/win32ole/win32ole.c25
2 files changed, 18 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index b95e9e1a0d3..caf40fd226b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Jul 29 22:21:37 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+
+ * ext/win32ole/win32ole.c (hash2olerec): ignore WIN32OLE_RECORD
+ instance variable if the variable is nil.
+
Tue Jul 29 19:43:27 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
* ext/win32ole/win32ole.c (folerecord_method_missing): refactoring.
diff --git a/ext/win32ole/win32ole.c b/ext/win32ole/win32ole.c
index 9f1ae2ea333..7f1a7a5cff5 100644
--- a/ext/win32ole/win32ole.c
+++ b/ext/win32ole/win32ole.c
@@ -143,7 +143,7 @@ const IID IID_IMultiLanguage2 = {0xDCCFC164, 0x2B38, 0x11d2, {0xB7, 0xEC, 0x00,
#define WC2VSTR(x) ole_wc2vstr((x), TRUE)
-#define WIN32OLE_VERSION "1.6.5"
+#define WIN32OLE_VERSION "1.6.6"
typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX)
(REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*);
@@ -1677,17 +1677,18 @@ hash2olerec(VALUE key, VALUE val, VALUE rec)
IRecordInfo *pri;
HRESULT hr;
- Data_Get_Struct(rec, struct olerecorddata, prec);
- pri = prec->pri;
-
- VariantInit(&var);
- ole_val2variant(val, &var);
- pbuf = ole_vstr2wc(key);
- hr = pri->lpVtbl->PutField(pri, INVOKE_PROPERTYPUT, prec->pdata, pbuf, &var);
- SysFreeString(pbuf);
- VariantClear(&var);
- if (FAILED(hr)) {
- ole_raise(hr, eWIN32OLERuntimeError, "failed to putfield of `%s`", StringValuePtr(key));
+ if (val != Qnil) {
+ Data_Get_Struct(rec, struct olerecorddata, prec);
+ pri = prec->pri;
+ VariantInit(&var);
+ ole_val2variant(val, &var);
+ pbuf = ole_vstr2wc(key);
+ hr = pri->lpVtbl->PutField(pri, INVOKE_PROPERTYPUT, prec->pdata, pbuf, &var);
+ SysFreeString(pbuf);
+ VariantClear(&var);
+ if (FAILED(hr)) {
+ ole_raise(hr, eWIN32OLERuntimeError, "failed to putfield of `%s`", StringValuePtr(key));
+ }
}
return ST_CONTINUE;
}