From 1075d2ddabf8ac1dd6ec0650449361ec3c0f9a1c Mon Sep 17 00:00:00 2001 From: p3lim Date: Wed, 5 Jan 2011 13:22:57 +0100 Subject: [PATCH] Stop the value check early if the link bonks --- Monomyth.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Monomyth.lua b/Monomyth.lua index 74bcde2..7456053 100644 --- a/Monomyth.lua +++ b/Monomyth.lua @@ -55,16 +55,18 @@ addon:Register('QUEST_COMPLETE', function() local bestValue, bestIndex = 0 for index = 1, GetNumQuestChoices() do - local _, _, _, _, _, _, _, _, _, _, value = GetItemInfo(GetQuestItemLink('choice', index)) - + local link = GetQuestItemLink('choice', index) + if(not link) then + return + end + + local _, _, _, _, _, _, _, _, _, _, value = GetItemInfo(link) if(value > bestValue) then bestValue, bestIndex = value, index end end - if(bestIndex) then -- XXX: Debug this one - _G['QuestInfoItem' .. bestIndex]:Click() - end + _G['QuestInfoItem' .. bestIndex]:Click() end end) -- 1.7.9.5