Quantcast

Fix not fully successful inspects being saved as valid inspect cache entries.

Peter Eliasson [01-23-15 - 16:23]
Fix not fully successful inspects being saved as valid inspect cache entries.
Filename
src/inspect.lua
diff --git a/src/inspect.lua b/src/inspect.lua
index 7d49dab..1a1abf1 100644
--- a/src/inspect.lua
+++ b/src/inspect.lua
@@ -100,9 +100,14 @@ end

 local function setPlayerInspectCache(playerId, specName, itemLevel)
 	inspectCache[playerId] = {};
-	inspectCache[playerId].time = GetTime();
 	inspectCache[playerId].specName = specName;
 	inspectCache[playerId].itemLevel = itemLevel;
+	if specName and itemLevel then
+		-- Dont set time if not all values are provided, as that would
+		-- make this entry valid and prevent inspections of the player
+		-- for the duration of the INSPECT_CACHE_TIMEOUT.
+		inspectCache[playerId].time = GetTime();
+	end
 end

 function inspect:StartNotifyInspectTimer()