Fix: Add nil checks to QuestiePlayer:Initialize to prevent arithmetic errors on custom servers
This commit is contained in:
@@ -36,16 +36,20 @@ QuestiePlayer.numberOfGroupMembers = 0
|
|||||||
QuestiePlayer.pendingCompleteQuestIds = {}
|
QuestiePlayer.pendingCompleteQuestIds = {}
|
||||||
|
|
||||||
function QuestiePlayer:Initialize()
|
function QuestiePlayer:Initialize()
|
||||||
_QuestiePlayer.playerLevel = UnitLevel("player")
|
_QuestiePlayer.playerLevel = UnitLevel("player") or 1
|
||||||
|
|
||||||
playerRaceId = select(3, UnitRace("player"))
|
playerRaceId = select(3, UnitRace("player"))
|
||||||
playerRaceFlag = 2 ^ (playerRaceId - 1)
|
if playerRaceId then
|
||||||
playerRaceFlagX2 = 2 * playerRaceFlag
|
playerRaceFlag = 2 ^ (playerRaceId - 1)
|
||||||
|
playerRaceFlagX2 = 2 * playerRaceFlag
|
||||||
|
end
|
||||||
|
|
||||||
playerClassName = select(1, UnitClass("player"))
|
playerClassName = select(1, UnitClass("player")) or "UNKNOWN"
|
||||||
local classId = select(3, UnitClass("player"))
|
local classId = select(3, UnitClass("player"))
|
||||||
playerClassFlag = 2 ^ (classId - 1)
|
if classId then
|
||||||
playerClassFlagX2 = 2 * playerClassFlag
|
playerClassFlag = 2 ^ (classId - 1)
|
||||||
|
playerClassFlagX2 = 2 * playerClassFlag
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--Always compare to the UnitLevel parameter, returning the highest.
|
--Always compare to the UnitLevel parameter, returning the highest.
|
||||||
|
|||||||
Reference in New Issue
Block a user