Commit 9000342a authored by hpi1's avatar hpi1

Fixed segfault when Java class not found (invalid classpath, ...)

parent 6dd267eb
#include "util/logging.h"
#include "bdj_util.h"
jobject bdj_make_object(JNIEnv* env, const char* name, const char* sig, ...)
......@@ -5,6 +8,11 @@ jobject bdj_make_object(JNIEnv* env, const char* name, const char* sig, ...)
jclass obj_class = (*env)->FindClass(env, name);
jmethodID obj_constructor = (*env)->GetMethodID(env, obj_class, "<init>", sig);
if (!obj_class) {
BD_DEBUG(DBG_BDJ | DBG_CRIT, "Class %s not found\n", name);
return NULL;
}
va_list ap;
va_start(ap, sig);
jobject obj = (*env)->NewObjectV(env, obj_class, obj_constructor, ap);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment