Skip to content

Commit

Permalink
Validate mode before saving settings (#8235)
Browse files Browse the repository at this point in the history
* FIX: validate mode before saving settings

* FIX: typo
  • Loading branch information
Paliak committed Aug 31, 2024
1 parent d095f3a commit 6974f9f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Modules/Main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,12 @@ function main:SaveSettings()
end
t_insert(mode, child)
end

-- if setting save is attempted and mode is nil something has gone very wrong
if not mode.attrib.mode or not mode[1] then
launch:ShowErrMsg("^1Error saving 'Settings.xml': mode element is invalid")
return true
end
t_insert(setXML, mode)
local accounts = { elem = "Accounts", attrib = { lastAccountName = self.lastAccountName, lastRealm = self.lastRealm } }
for accountName, account in pairs(self.gameAccounts) do
Expand Down

0 comments on commit 6974f9f

Please sign in to comment.