From 852983d46a5f112f4c5361c763fcbdfcba7d1ee6 Mon Sep 17 00:00:00 2001 From: "Johnny C. Lam" Date: Sat, 16 Mar 2013 08:04:24 +0000 Subject: [PATCH] Guard against bad slot names to GetEquippedItem(). git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@783 d5049fe3-3747-40f7-a4b5-f36d6801af5f --- OvaleEquipement.lua | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/OvaleEquipement.lua b/OvaleEquipement.lua index 5280884..20e2300 100644 --- a/OvaleEquipement.lua +++ b/OvaleEquipement.lua @@ -45,6 +45,29 @@ local INVSLOT_WRIST = INVSLOT_WRIST -- item IDs of equipped items, indexed by slot ID local equippedItems = {} +-- equipment slot names +local slotName = { + AmmoSlot = true, + BackSlot = true, + ChestSlot = true, + FeetSlot = true, + Finger0Slot = true, + Finger1Slot = true, + HandsSlot = true, + HeadSlot = true, + LegsSlot = true, + MainHandSlot = true, + NeckSlot = true, + RangedSlot = true, + SecondaryHandSlot = true, + ShirtSlot = true, + ShoulderSlot = true, + TabardSlot = true, + Trinket0Slot = true, + Trinket1Slot = true, + WaistSlot = true, + WristSlot = true, +} -- type of main-hand item equipped local mainHandItemType -- type of off-hand item equipped @@ -976,6 +999,7 @@ end function OvaleEquipement:GetEquippedItem(slotId) if type(slotId) ~= "number" then + if not slotName[slotId] then return nil end slotId = GetInventorySlotInfo(slotId) if not slotId then return nil end end -- 1.7.9.5