diff --git a/src/java/Ref.hxx b/src/java/Ref.hxx index 37c85a5e9..bd62b17d7 100644 --- a/src/java/Ref.hxx +++ b/src/java/Ref.hxx @@ -62,7 +62,8 @@ namespace Java { value(std::exchange(src.value, nullptr)) {} ~LocalRef() noexcept { - env->DeleteLocalRef(value); + if (value != nullptr) + env->DeleteLocalRef(value); } LocalRef(const LocalRef &other) = delete;