diff --git a/indra/llcommon/llinstancetracker.h b/indra/llcommon/llinstancetracker.h
index 7ef7d101db70bc73f1d0419430dff14decd9a760..55187d8325cf554d8c89e80ecaec61efdff47199 100755
--- a/indra/llcommon/llinstancetracker.h
+++ b/indra/llcommon/llinstancetracker.h
@@ -212,8 +212,11 @@ class LLInstanceTracker : public LLInstanceTrackerBase
 	}
 	void remove_()
 	{
-        if (getMap_().find(mInstanceKey) != getMap_().end())
-		getMap_().erase(mInstanceKey);
+		typename InstanceMap::iterator iter = getMap_().find(mInstanceKey);
+		if (iter != getMap_().end())
+		{
+			getMap_().erase(iter);
+		}
 	}
 
 private: