View Single Post
02-13-17, 10:53 PM   #2
lightspark
A Rage Talon Dragon Guard
 
lightspark's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2012
Posts: 341
Isn't it normal behaviour for any Get*Info function? I don't think GetQuestItemInfo is different from GetItemInfo. If item isn't cached yet, you'll get either incomplete data or a bunch of nils.

When you request info on not yet cached item, you need to register for GET_ITEM_INFO_RECEIVED event, after this event fires you need to request info again, but I'm not sure if GET_ITEM_INFO_RECEIVED fires after GetQuestItemInfo calls

Alternatively you may try to call stuff recursively w/ some delay if info is missing:

Lua Code:
  1. local function test_func(itemID)
  2.     local _, link = GetItemInfo(itemID)
  3.  
  4.     if not link then
  5.         return C_Timer.After(0.25, function() test_func(itemID) end)
  6.     end
  7.  
  8.     -- do everything else here
  9. end

Some checks to avoid infinite loops may be quite useful too
__________________
  Reply With Quote