Skip to content

Commit

Permalink
Edge case
Browse files Browse the repository at this point in the history
Catch some edge cases where setting up the initial window with out of date window positioning settings would throw an error. Should be limited to intermediate dev builds, but doing a release anyway to be sure.
  • Loading branch information
prowley committed Sep 29, 2020
1 parent 78f6acf commit ae839d0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion SteaSummon.toc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## Title: SteaSummon
## Notes: Warlock Summoning
## Author: Stea
## Version: 0.47
## Version: 0.48
## SavedVariablesPerCharacter: SteaSummonSave, SteaDEBUG


Expand Down
10 changes: 5 additions & 5 deletions settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ settings = {
SteaSummonSave.buffs = true
end

if SteaSummonSave.windowPos == nil then
SteaSummonSave.windowPos = {}
if SteaSummonSave.windowPos == nil or (type(SteaSummonSave.windowPos[2]) == "table" or not SteaSummonSave.windowPos["height"]) then
SteaSummonSave.windowPos = {"CENTER", nil, "CENTER", 0, 0, ["height"] = 300, ["width"] = 250}
end
end,

Expand All @@ -81,7 +81,7 @@ settings = {
SteaSummonSave.timeStamp = 0
SteaSummonSave.waitingKeepTime = 5
SteaSummonSave.buffs = true
SteaSummonSave.windowPos = {}
SteaSummonSave.windowPos = {"CENTER", nil, "CENTER", 0, 0, ["height"] = 300, ["width"] = 250}
end,

findSummonWord = function(self, phrase)
Expand Down Expand Up @@ -143,11 +143,11 @@ settings = {
end,

getWindowPos = function(self)
return SteaSummonSave.winowPos
return SteaSummonSave.windowPos
end,

setWindowPos = function(self, pos)
SteaSummonSave.winowPos = pos
SteaSummonSave.windowPos = pos
end,
}

Expand Down
5 changes: 3 additions & 2 deletions summon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,10 @@ local summon = {
f:SetPoint("CENTER")
f:SetSize(300, 250)
f:SetScale(SteaSummonSave.windowSize)

local wpos = addonData.settings:getWindowPos()
if wpos and #wpos then
cprint("summon.display", wpos[1], wpos[2], wpos[3], wpos[4], wpos[5], "width:", wpos["width"], "height:", wpos["height"])
if wpos and #wpos > 0 then
db("summon.display", wpos[1], wpos[2], wpos[3], wpos[4], wpos[5], "width:", wpos["width"], "height:", wpos["height"])
f:ClearAllPoints()
f:SetPoint(wpos[1], wpos[2], wpos[3], wpos[4], wpos[5])
--f:SetPoint("TOPLEFT", UIParent, "TOPLEFT", wpos["left"], wpos["top"])
Expand Down

0 comments on commit ae839d0

Please sign in to comment.