java/Ref: add nullptr check to destructor
May allow the compiler to optimize calls away.
This commit is contained in:
parent
6e58fd1583
commit
296ec4d07c
@ -62,7 +62,8 @@ namespace Java {
|
|||||||
value(std::exchange(src.value, nullptr)) {}
|
value(std::exchange(src.value, nullptr)) {}
|
||||||
|
|
||||||
~LocalRef() noexcept {
|
~LocalRef() noexcept {
|
||||||
env->DeleteLocalRef(value);
|
if (value != nullptr)
|
||||||
|
env->DeleteLocalRef(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
LocalRef(const LocalRef &other) = delete;
|
LocalRef(const LocalRef &other) = delete;
|
||||||
|
Loading…
Reference in New Issue
Block a user