Skip to content

Commit

Permalink
fix infinity loop
Browse files Browse the repository at this point in the history
  • Loading branch information
yujincheng08 authored Dec 7, 2023
1 parent e5c3b90 commit 5ea18ee
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lsplant/src/main/jni/include/utils/jni_helper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1032,8 +1032,8 @@ class JObjectArrayElement {
friend class ScopedLocalRef<jobjectArray>;

auto obtain() {
if (i_ < 0 || i_ >= size_) return JObjectArrayElement(env_, array_, i_, ScopedLocalRef<jobject>{nullptr});
return JObjectArrayElement(env_, array_, i_, JNI_SafeInvoke(env_, &JNIEnv::GetObjectArrayElement, array_, i_));
if (i_ < 0 || i_ >= size_) ScopedLocalRef<jobject>{nullptr};
return JNI_SafeInvoke(env_, &JNIEnv::GetObjectArrayElement, array_, i_);
}

explicit JObjectArrayElement(JNIEnv * env, jobjectArray array, int i, size_t size_) :
Expand Down Expand Up @@ -1077,7 +1077,7 @@ class JObjectArrayElement {
}

JObjectArrayElement& operator=(const JObjectArrayElement& s) {
item_.reset(env_->NewLocalRef(s.get()));
item_ = s.item_.clone();
return *this;
}

Expand Down

0 comments on commit 5ea18ee

Please sign in to comment.