Quantcast

Fixed LUA error, where no weapon is equipped.

Taracque [09-13-13 - 10:38]
Fixed LUA error, where no weapon is equipped.
Filename
DKCrutch.lua
diff --git a/DKCrutch.lua b/DKCrutch.lua
index 65b0502..05092f4 100755
--- a/DKCrutch.lua
+++ b/DKCrutch.lua
@@ -1,5 +1,5 @@
 -------------------------------------------------------------------------------
--- DKCrutch 0.9.4
+-- DKCrutch 0.9.5
 --
 -- Death Knight rune tracker and ability advisor
 -------------------------------------------------------------------------------
@@ -8,7 +8,7 @@ DKCrutch = {Locals = {}}

 local L = DKCrutch.Locals

-DKCrutch.versionNumber = '0.9.4'
+DKCrutch.versionNumber = '0.9.5'
 DKCrutch.talent = ""
 DKCrutch.talentUnsure = true
 DKCrutch.DebugMode = false
@@ -121,12 +121,14 @@ function DKCrutch.events.PLAYER_ALIVE()
 end

 function DKCrutch.events.PLAYER_EQUIPMENT_CHANGED()
-	local _, itemType;
+	local _, itemType, itemSlot;

 	DKCrutch.hasT15_4pcs = DKCrutch:HasSetBonus( 138347, 4 );
-
-	_, _, _, _, _, _, _, _, itemType = GetItemInfo( GetInventoryItemID("player", GetInventorySlotInfo("MainHandSlot")));
-	DKCrutch.dualWield = (itemType == "INVTYPE_WEAPON");
+	_, itemSlot = GetInventorySlotInfo("MainHandSlot");
+	if (itemSlot) then
+		_, _, _, _, _, _, _, _, itemType = GetItemInfo( GetInventoryItemID("player", itemSlot));
+		DKCrutch.dualWield = (itemType == "INVTYPE_WEAPON");
+	end
 end

 function DKCrutch.events.PLAYER_ENTERING_WORLD()