Guard all LibSharedMedia-3.0 usages against nil LSM - OptionalDep may not load
- Use LibStub(..., true) silent flag on all LSM acquisition sites - Guard HashTable() calls in Options files (returns nil if no font type registered) - Guard all Fetch() call sites with inline 'LSM30 and LSM30:Fetch() or fallback' - Make font values lazy functions in options dropdowns so LSM has time to register - Affects: QuestieOptionsTracker, QuestieOptionsArrow, QuestieArrow, QuestieTracker, TrackerHeaderFrame, TrackerLinePool, TrackerQuestTimers
This commit is contained in:
@@ -17,7 +17,7 @@ local QuestiePlayer = QuestieLoader:ImportModule("QuestiePlayer")
|
||||
local QuestieQuest = QuestieLoader:ImportModule("QuestieQuest")
|
||||
|
||||
local HBD = QuestieCompat.HBD or LibStub("HereBeDragonsQuestie-2.0")
|
||||
local SharedMedia = LibStub("LibSharedMedia-3.0")
|
||||
local SharedMedia = LibStub and LibStub("LibSharedMedia-3.0", true)
|
||||
|
||||
local atan2 = math.atan2
|
||||
local pi = math.pi
|
||||
@@ -807,7 +807,7 @@ function QuestieArrow:UpdateFont()
|
||||
if not arrowFrame then return end
|
||||
local fontSize = Questie.db.profile.arrowFontSize or 10
|
||||
local fontName = Questie.db.profile.arrowFont or "Friz Quadrata TT"
|
||||
local fontFace = SharedMedia:Fetch("font", fontName) or fontName
|
||||
local fontFace = (SharedMedia and SharedMedia.Fetch and SharedMedia:Fetch("font", fontName)) or fontName
|
||||
if arrowFrame.title then
|
||||
arrowFrame.title:SetFont(fontFace, fontSize, "OUTLINE")
|
||||
end
|
||||
|
||||
@@ -27,14 +27,19 @@ QuestieOptions.tabs.tracker = { ... }
|
||||
local _GetShortcuts
|
||||
local trackerOptions = {}
|
||||
|
||||
local SharedMedia = LibStub("LibSharedMedia-3.0")
|
||||
local SharedMedia = LibStub and LibStub("LibSharedMedia-3.0", true)
|
||||
|
||||
-- Build expanded font list from SharedMedia + common WoW fonts
|
||||
local function GetExpandedFontList()
|
||||
local fonts = {}
|
||||
-- Add SharedMedia fonts (HashTable returns key-value table)
|
||||
for name, _ in pairs(SharedMedia:HashTable("font")) do
|
||||
fonts[name] = name
|
||||
-- Add SharedMedia fonts if available (HashTable returns nil if media type not registered yet)
|
||||
if SharedMedia and SharedMedia.HashTable then
|
||||
local lsmFonts = SharedMedia:HashTable("font")
|
||||
if lsmFonts then
|
||||
for name, _ in pairs(lsmFonts) do
|
||||
fonts[name] = name
|
||||
end
|
||||
end
|
||||
end
|
||||
-- Add common WoW fonts not typically in SharedMedia
|
||||
local wowFonts = {
|
||||
|
||||
@@ -48,7 +48,7 @@ local GetQuestLogTitle = QuestieCompat.GetQuestLogTitle
|
||||
local GetQuestLogIndexByID = QuestieCompat.GetQuestLogIndexByID
|
||||
local GetItemInfo = QuestieCompat.GetItemInfo
|
||||
|
||||
local LSM30 = LibStub("LibSharedMedia-3.0")
|
||||
local LSM30 = LibStub and LibStub("LibSharedMedia-3.0", true)
|
||||
|
||||
-- Local Vars
|
||||
local trackerLineWidth = 0
|
||||
@@ -1275,7 +1275,7 @@ function QuestieTracker:Update()
|
||||
line.label:SetPoint("TOPLEFT", line, "TOPLEFT", lineWidthQBC, 0)
|
||||
|
||||
-- Set Timer font
|
||||
line.label:SetFont(LSM30:Fetch("font", Questie.db.profile.trackerFontObjective),
|
||||
line.label:SetFont(LSM30 and LSM30:Fetch("font", Questie.db.profile.trackerFontObjective) or Questie.db.profile.trackerFontObjective,
|
||||
Questie.db.profile.trackerFontSizeObjective, Questie.db.profile.trackerFontOutline)
|
||||
|
||||
-- Set Timer Title based on states
|
||||
|
||||
@@ -26,7 +26,7 @@ local QuestieQuest = QuestieLoader:ImportModule("QuestieQuest")
|
||||
local QuestieCombatQueue = QuestieLoader:ImportModule("QuestieCombatQueue")
|
||||
---@type l10n
|
||||
local l10n = QuestieLoader:ImportModule("l10n")
|
||||
local LSM30 = LibStub("LibSharedMedia-3.0")
|
||||
local LSM30 = LibStub and LibStub("LibSharedMedia-3.0", true)
|
||||
|
||||
--- COMPATIBILITY ---
|
||||
local C_QuestLog = QuestieCompat.C_QuestLog
|
||||
@@ -209,7 +209,7 @@ function TrackerHeaderFrame:Update()
|
||||
headerFrame.questieIcon:SetPoint("TOPLEFT", headerFrame, "TOPLEFT", 6, 0)
|
||||
headerFrame.questieIcon:Show()
|
||||
|
||||
headerFrame.trackedQuests.label:SetFont(LSM30:Fetch("font", Questie.db.profile.trackerFontHeader), trackerFontSizeHeader, Questie.db.profile.trackerFontOutline)
|
||||
headerFrame.trackedQuests.label:SetFont(LSM30 and LSM30:Fetch("font", Questie.db.profile.trackerFontHeader) or Questie.db.profile.trackerFontHeader, trackerFontSizeHeader, Questie.db.profile.trackerFontOutline)
|
||||
|
||||
local maxQuestAmount = "/" .. C_QuestLog.GetMaxNumQuestsCanAccept()
|
||||
local _, activeQuests = GetNumQuestLogEntries()
|
||||
|
||||
@@ -37,7 +37,7 @@ local C_QuestLog = QuestieCompat.C_QuestLog
|
||||
local GetQuestLogIndexByID = QuestieCompat.GetQuestLogIndexByID
|
||||
|
||||
local LibDropDown = QuestieCompat.LibUIDropDownMenu or LibStub:GetLibrary("LibUIDropDownMenuQuestie-4.0")
|
||||
local LSM30 = LibStub("LibSharedMedia-3.0")
|
||||
local LSM30 = LibStub and LibStub("LibSharedMedia-3.0", true)
|
||||
|
||||
local linePoolSize = 250
|
||||
local lineIndex = 0
|
||||
@@ -562,7 +562,7 @@ function TrackerLinePool.Initialize(questFrame)
|
||||
|
||||
-- Charges Updates
|
||||
self.count:Hide()
|
||||
self.count:SetFont(LSM30:Fetch("font", Questie.db.profile.trackerFontQuest), Questie.db.profile.trackerFontSizeQuest, "OUTLINE")
|
||||
self.count:SetFont(LSM30 and LSM30:Fetch("font", Questie.db.profile.trackerFontQuest) or Questie.db.profile.trackerFontQuest, Questie.db.profile.trackerFontSizeQuest, "OUTLINE")
|
||||
if self.charges > 1 then
|
||||
self.count:SetText(self.charges)
|
||||
self.count:Show()
|
||||
@@ -1089,16 +1089,16 @@ TrackerLinePool.SetMode = function(self, mode)
|
||||
self.mode = mode
|
||||
if mode == "zone" then
|
||||
local trackerFontSizeZone = Questie.db.profile.trackerFontSizeZone
|
||||
self.label:SetFont(LSM30:Fetch("font", Questie.db.profile.trackerFontZone), trackerFontSizeZone, Questie.db.profile.trackerFontOutline)
|
||||
self.label:SetFont(LSM30 and LSM30:Fetch("font", Questie.db.profile.trackerFontZone) or Questie.db.profile.trackerFontZone, trackerFontSizeZone, Questie.db.profile.trackerFontOutline)
|
||||
self.label:SetHeight(trackerFontSizeZone)
|
||||
elseif mode == "quest" or mode == "achieve" then
|
||||
local trackerFontSizeQuest = Questie.db.profile.trackerFontSizeQuest
|
||||
self.label:SetFont(LSM30:Fetch("font", Questie.db.profile.trackerFontQuest), trackerFontSizeQuest, Questie.db.profile.trackerFontOutline)
|
||||
self.label:SetFont(LSM30 and LSM30:Fetch("font", Questie.db.profile.trackerFontQuest) or Questie.db.profile.trackerFontQuest, trackerFontSizeQuest, Questie.db.profile.trackerFontOutline)
|
||||
self.label:SetHeight(trackerFontSizeQuest)
|
||||
self.button = nil
|
||||
elseif mode == "objective" then
|
||||
local trackerFontSizeObjective = Questie.db.profile.trackerFontSizeObjective
|
||||
self.label:SetFont(LSM30:Fetch("font", Questie.db.profile.trackerFontObjective), trackerFontSizeObjective, Questie.db.profile.trackerFontOutline)
|
||||
self.label:SetFont(LSM30 and LSM30:Fetch("font", Questie.db.profile.trackerFontObjective) or Questie.db.profile.trackerFontObjective, trackerFontSizeObjective, Questie.db.profile.trackerFontOutline)
|
||||
self.label:SetHeight(trackerFontSizeObjective)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -16,7 +16,7 @@ local QuestieCombatQueue = QuestieLoader:ImportModule("QuestieCombatQueue")
|
||||
--- COMPATIBILITY ---
|
||||
local GetQuestLogIndexByID = QuestieCompat.GetQuestLogIndexByID
|
||||
|
||||
local LSM30 = LibStub("LibSharedMedia-3.0")
|
||||
local LSM30 = LibStub and LibStub("LibSharedMedia-3.0", true)
|
||||
|
||||
local WatchFrame = QuestTimerFrame or WatchFrame
|
||||
local blizzardTimerLocation = {}
|
||||
@@ -163,7 +163,7 @@ function TrackerQuestTimers:UpdateTimerFrame()
|
||||
local timeRemainingString, timeRemaining = TrackerQuestTimers:GetRemainingTimeByQuestId(timer.questId)
|
||||
if timeRemainingString ~= nil then
|
||||
Questie:Debug(Questie.DEBUG_SPAM, "[TrackerQuestTimers:UpdateTimerFrame] - ", timeRemainingString)
|
||||
timer.frame.label:SetFont(LSM30:Fetch("font", Questie.db.profile.trackerFontObjective), Questie.db.profile.trackerFontSizeObjective, Questie.db.profile.trackerFontOutline)
|
||||
timer.frame.label:SetFont(LSM30 and LSM30:Fetch("font", Questie.db.profile.trackerFontObjective) or Questie.db.profile.trackerFontObjective, Questie.db.profile.trackerFontSizeObjective, Questie.db.profile.trackerFontOutline)
|
||||
timer.frame.label:SetText(Questie:Colorize(timeRemainingString, "blue"))
|
||||
timer.frame:SetWidth(timer.frame.label:GetWidth() + ((34) - (18 - Questie.db.profile.trackerFontSizeQuest)) + Questie.db.profile.trackerFontSizeQuest)
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user