androidmedia: Add more null checks (of env) to JNI utilities

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5138>
This commit is contained in:
Ryan Pavlik 2023-07-19 18:08:32 -05:00
parent c506748c6f
commit 6e5ca29e8f

View file

@ -201,6 +201,7 @@ jobject
gst_amc_jni_object_make_global (JNIEnv * env, jobject object)
{
jobject ret;
g_return_val_if_fail (env != NULL, NULL);
g_return_val_if_fail (object != NULL, NULL);
ret = (*env)->NewGlobalRef (env, object);
@ -216,6 +217,7 @@ jobject
gst_amc_jni_object_ref (JNIEnv * env, jobject object)
{
jobject ret;
g_return_val_if_fail (env != NULL, NULL);
g_return_val_if_fail (object != NULL, NULL);
ret = (*env)->NewGlobalRef (env, object);
@ -228,6 +230,7 @@ gst_amc_jni_object_ref (JNIEnv * env, jobject object)
void
gst_amc_jni_object_unref (JNIEnv * env, jobject object)
{
g_return_if_fail (env != NULL);
g_return_if_fail (object != NULL);
(*env)->DeleteGlobalRef (env, object);
@ -236,6 +239,7 @@ gst_amc_jni_object_unref (JNIEnv * env, jobject object)
void
gst_amc_jni_object_local_unref (JNIEnv * env, jobject object)
{
g_return_if_fail (env != NULL);
g_return_if_fail (object != NULL);
(*env)->DeleteLocalRef (env, object);