[libbluray-devel] Fixed segfault when Java class not found (invalid classpath, ...)

hpi1 git at videolan.org
Fri May 6 10:59:08 CEST 2011


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Fri May  6 11:46:56 2011 +0300| [9000342a2f94d0116bfdc344ed2eeb06372f5dd2] | committer: hpi1

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

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=9000342a2f94d0116bfdc344ed2eeb06372f5dd2
---

 src/libbluray/bdj/bdj_util.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/libbluray/bdj/bdj_util.c b/src/libbluray/bdj/bdj_util.c
index a4e4b24..5bf4560 100644
--- a/src/libbluray/bdj/bdj_util.c
+++ b/src/libbluray/bdj/bdj_util.c
@@ -1,3 +1,6 @@
+
+#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);



More information about the libbluray-devel mailing list