From: hyuna0213.jo Date: Tue, 18 Oct 2016 12:49:22 +0000 (+0900) Subject: Added null check logic for JniOnPublishResourceListener X-Git-Tag: 1.3.0~1054^2~107 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=85b64a3517de7275f6135d9e09c0a6ed6a82d2b1;p=platform%2Fupstream%2Fiotivity.git 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 (cherry picked from commit 86c3e7a2500b689a074d2099017cb96a5ea1f0e9) Reviewed-on: https://gerrit.iotivity.org/gerrit/13603 Reviewed-by: jihwan seo Reviewed-by: George Nash Reviewed-by: Larry Sachs Reviewed-by: Rick Bell --- 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) {