comparison Main.lua @ 440:a4256abd13b7

Added a conditional check to protect against collecting instance information when not in an instance.
author MMOSimca <MMOSimca@gmail.com>
date Sat, 28 Feb 2015 05:01:29 -0500
parents 2baf8d90d8a8
children 7e0ef2127b49
comparison
equal deleted inserted replaced
439:2baf8d90d8a8 440:a4256abd13b7
348 end 348 end
349 end -- do-block 349 end -- do-block
350 350
351 351
352 local function InstanceDifficultyToken() 352 local function InstanceDifficultyToken()
353 local _, instance_type, instance_difficulty, _, _, _, is_dynamic = _G.GetInstanceInfo() 353 -- Sometimes, instance information is returned when not in an instance. This check protects against that.
354 354 if _G.IsInInstance() then
355 if not instance_type or instance_type == "" then 355 local _, instance_type, instance_difficulty, _, _, _, is_dynamic = _G.GetInstanceInfo()
356 instance_type = "NONE" 356
357 end 357 if not instance_type or instance_type == "" then
358 return ("%s:%d:%s"):format(instance_type:upper(), instance_difficulty, tostring(is_dynamic)) 358 instance_type = "NONE"
359 end
360 return ("%s:%d:%s"):format(instance_type:upper(), instance_difficulty, tostring(is_dynamic))
361 end
362 return "NONE:0:false"
359 end 363 end
360 364
361 365
362 local function DBEntry(data_type, unit_id) 366 local function DBEntry(data_type, unit_id)
363 if not data_type or not unit_id then 367 if not data_type or not unit_id then