From 0d144a0881c4ae4d96c40e634c4d50a804f64885 Mon Sep 17 00:00:00 2001 From: LoveSy Date: Thu, 7 Dec 2023 09:56:23 +0800 Subject: [PATCH] fix infinity loop --- lsplant/src/main/jni/include/utils/jni_helper.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lsplant/src/main/jni/include/utils/jni_helper.hpp b/lsplant/src/main/jni/include/utils/jni_helper.hpp index e2455d7..568c49b 100644 --- a/lsplant/src/main/jni/include/utils/jni_helper.hpp +++ b/lsplant/src/main/jni/include/utils/jni_helper.hpp @@ -1032,8 +1032,8 @@ class JObjectArrayElement { friend class ScopedLocalRef; auto obtain() { - if (i_ < 0 || i_ >= size_) return JObjectArrayElement(env_, array_, i_, ScopedLocalRef{nullptr}); - return JObjectArrayElement(env_, array_, i_, JNI_SafeInvoke(env_, &JNIEnv::GetObjectArrayElement, array_, i_)); + if (i_ < 0 || i_ >= size_) ScopedLocalRef{nullptr}; + return JNI_SafeInvoke(env_, &JNIEnv::GetObjectArrayElement, array_, i_); } explicit JObjectArrayElement(JNIEnv * env, jobjectArray array, int i, size_t size_) : @@ -1077,7 +1077,7 @@ public: } JObjectArrayElement& operator=(const JObjectArrayElement& s) { - item_.reset(env_->NewLocalRef(s.get())); + item_ = s.item_.clone(); return *this; }