From c9d9042affc3235286e1cf6bf1d4e4b6fcecc682 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 22 Jan 2016 17:25:28 +0200 Subject: [PATCH] ahc: Fail gracefully if our callback class can't be found Instead of just ignoring that error and then calling JNI functions with NULL, which will kill the virtual machine. The error handling here needs some further improvements though, errors in more places are just ignored. --- sys/androidmedia/gst-android-hardware-camera.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/androidmedia/gst-android-hardware-camera.c b/sys/androidmedia/gst-android-hardware-camera.c index fe4c80ebce..3a78470b7c 100644 --- a/sys/androidmedia/gst-android-hardware-camera.c +++ b/sys/androidmedia/gst-android-hardware-camera.c @@ -1663,6 +1663,9 @@ _init_classes (void) gst_amc_jni_get_class (env, &err, "org/freedesktop/gstreamer/androidmedia/GstAhcCallback"); } + if (!org_freedesktop_gstreamer_androidmedia_gstahccallback.klass) + goto failed; + org_freedesktop_gstreamer_androidmedia_gstahccallback.constructor = gst_amc_jni_get_method_id (env, &err, org_freedesktop_gstreamer_androidmedia_gstahccallback.klass, "",