From da431135fa17c12efdf4532fe1a88000adf5e35d Mon Sep 17 00:00:00 2001 From: elsid Date: Mon, 10 Dec 2018 23:51:15 +0300 Subject: [PATCH] Use pointer to check is NavMeshTilesCache::Value initialized --- components/detournavigator/navmeshtilescache.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/components/detournavigator/navmeshtilescache.hpp b/components/detournavigator/navmeshtilescache.hpp index 23033cce4..7418c4d3a 100644 --- a/components/detournavigator/navmeshtilescache.hpp +++ b/components/detournavigator/navmeshtilescache.hpp @@ -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: