From 86c3e7a2500b689a074d2099017cb96a5ea1f0e9 Mon Sep 17 00:00:00 2001 From: "hyuna0213.jo" Date: Tue, 18 Oct 2016 21:49:22 +0900 Subject: [PATCH] Added null check logic for JniOnPublishResourceListener Added null check logic for JniOnPublishResourceListener Change-Id: I8967028583b951d2af049a46eb618ba0963db72f Signed-off-by: hyuna0213.jo Reviewed-on: https://gerrit.iotivity.org/gerrit/13399 Reviewed-by: Jaehong Jo Tested-by: jenkins-iotivity Reviewed-by: Ashok Babu Channa --- android/android_api/base/jni/JniOnPublishResourceListener.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/android/android_api/base/jni/JniOnPublishResourceListener.cpp b/android/android_api/base/jni/JniOnPublishResourceListener.cpp index 0204d86..4adc14a 100644 --- a/android/android_api/base/jni/JniOnPublishResourceListener.cpp +++ b/android/android_api/base/jni/JniOnPublishResourceListener.cpp @@ -57,6 +57,16 @@ void JniOnPublishResourceListener::onPublishResourceCallback( return; } + if (nullptr == m_jwListener) + { + LOGE("listener is not available"); + if (JNI_EDETACHED == envRet) + { + g_jvm->DetachCurrentThread(); + } + return; + } + jobject jListener = env->NewLocalRef(m_jwListener); if (!jListener) { -- 2.7.4