Use pointer to check is NavMeshTilesCache::Value initialized

pull/2072/head
elsid 6 years ago
parent aab7f2e8b9
commit da431135fa
No known key found for this signature in database
GPG Key ID: B845CB9FEE18AB40

@ -56,12 +56,12 @@ namespace DetourNavigator
Value(Value&& other)
: mOwner(other.mOwner), mIterator(other.mIterator)
{
other.mIterator = ItemIterator();
other.mOwner = nullptr;
}
~Value()
{
if (mIterator != ItemIterator())
if (mOwner)
mOwner->releaseItem(mIterator);
}
@ -69,13 +69,13 @@ namespace DetourNavigator
Value& operator =(Value&& other)
{
if (mIterator != ItemIterator())
if (mOwner)
mOwner->releaseItem(mIterator);
mOwner = other.mOwner;
mIterator = other.mIterator;
other.mIterator = ItemIterator();
other.mOwner = nullptr;
return *this;
}
@ -87,7 +87,7 @@ namespace DetourNavigator
operator bool() const
{
return mIterator != ItemIterator();
return mOwner;
}
private:

Loading…
Cancel
Save