Commit 296ec4d0 authored by Max Kellermann's avatar Max Kellermann Committed by Max Kellermann

java/Ref: add nullptr check to destructor

May allow the compiler to optimize calls away.
parent 6e58fd15
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment