Skip to content

Commit 0c7059a

Browse files
committed
Add nil file error message (ty OneDrive)
1 parent f1b5a06 commit 0c7059a

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

runtime/lua/xml.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ function xml.LoadXMLFile(fileName)
101101
end
102102
local fileText = fileHnd:read("*a")
103103
fileHnd:close()
104+
if not fileText then
105+
return nil, fileName.." file returns nil. OneDrive?"
106+
elseif fileText == "" then
107+
return nil, fileName.." file is empty"
108+
end
104109
return xml.ParseXML(fileText)
105110
end
106111

src/Modules/Main.lua

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,11 @@ end
506506

507507
function main:LoadSettings(ignoreBuild)
508508
local setXML, errMsg = common.xml.LoadXMLFile(self.userPath.."Settings.xml")
509+
if errMsg and not errMsg:match(".*No such file or directory") then
510+
ConPrintf("Error: '%s'", errMsg)
511+
launch:ShowErrMsg("^1"..errMsg)
512+
return true
513+
end
509514
if not setXML then
510515
return true
511516
elseif setXML[1].elem ~= "PathOfBuilding2" then
@@ -640,6 +645,11 @@ end
640645

641646
function main:LoadSharedItems()
642647
local setXML, errMsg = common.xml.LoadXMLFile(self.userPath.."Settings.xml")
648+
if errMsg and not errMsg:match(".*No such file or directory") then
649+
ConPrintf("Error: '%s'", errMsg)
650+
launch:ShowErrMsg("^1"..errMsg)
651+
return true
652+
end
643653
if not setXML then
644654
return true
645655
elseif setXML[1].elem ~= "PathOfBuilding2" then

0 commit comments

Comments
 (0)