From 3c78ecf7fc36feaa01df4712023f835ef6b5db44 Mon Sep 17 00:00:00 2001 From: Tony Roberts Date: Wed, 26 Aug 2026 11:51:31 +0100 Subject: [PATCH] Set VARIANT type to VT_UNKNOWN if set to non-IDispatch instance When converting an object to a VARIANT, if QueryInterface fails to get the IDispatch interface, set the type to VT_IUNKNOWN. Fixes #93 --- native/variant.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/native/variant.cpp b/native/variant.cpp index fdebd3d2..2d2878b5 100644 --- a/native/variant.cpp +++ b/native/variant.cpp @@ -110,7 +110,10 @@ class ComObjectVariandHandlerImpl : public VariantHandlerImplRelease(); addr(v) = pDisp; v->vt = VT_DISPATCH; - } // otherwise use VT_UNKNOWN. See java.net issue 2. + } else { + // otherwise use VT_UNKNOWN. See java.net issue 2. + v->vt = VT_UNKNOWN; + } return v; } jobject get( JNIEnv* env, VARIANT* v, jclass retType ) {