Skip to content

Commit 7d10cde

Browse files
viruscampkohsuke
authored andcommitted
unmarshaller.h: add NULL check for SafeArrayUnmarshaller
MethodBinder.java: add NULL check for some special cases that cannot get IType from IParam
1 parent 6b31802 commit 7d10cde

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

native/unmarshaller.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,12 @@ class SafeArrayUnmarshaller : public Unmarshaller {
187187
}
188188

189189
virtual jarray unmarshal( JNIEnv* env ) {
190+
if(psa==NULL) return NULL;
190191
return XDUCER::toJava(env,psa);
191192
}
192193

193194
virtual ~SafeArrayUnmarshaller() {
195+
if(psa==NULL) return;
194196
SafeArrayDestroy(psa);
195197
}
196198
};

tlbimp/src/main/java/com4j/tlbimp/MethodBinder.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,12 @@ protected IType getReturnTypeBinding() throws BindingException {
6565
if (retParam == -1) {
6666
return null;
6767
}
68-
IPtrType pt = params[retParam].getType().queryInterface(IPtrType.class);
68+
IParam p = params[retParam];
69+
IType t = p.getType();
70+
if (t == null) {
71+
throw new BindingException(Messages.UNSUPPORTED_TYPE.format());
72+
}
73+
IPtrType pt = t.queryInterface(IPtrType.class);
6974
if (pt == null) {
7075
throw new BindingException(Messages.RETVAL_MUST_BY_REFERENCE.format());
7176
}

0 commit comments

Comments
 (0)