fix undefined error in server

This commit is contained in:
jane 2021-06-06 00:17:59 -04:00
parent 0729cd9ee5
commit 7346a2d379
3 changed files with 4 additions and 1 deletions

View file

@ -69,7 +69,7 @@ function diff(current, checked) {
console.log(`split: ${split}`); console.log(`split: ${split}`);
let index = filenames_checked.indexOf(split[0]); let index = filenames_checked.indexOf(split[0]);
console.log(`index: ${index}`); console.log(`index: ${index}`);
if (index == -1) { if (index == -1 || filenames_checked[index] == undefined) {
result += `${split[0]} download\n`; result += `${split[0]} download\n`;
continue; continue;
} }

View file

@ -60,6 +60,7 @@ local function getAllFiles()
local result = http.get(indexesUrl) local result = http.get(indexesUrl)
if result == nil then if result == nil then
print("error! getting indexes for " .. programToInstall) print("error! getting indexes for " .. programToInstall)
error()
end end
local resultText = result.readAll() local resultText = result.readAll()
local resultTable = split(resultText, "\n") local resultTable = split(resultText, "\n")

View file

@ -64,6 +64,7 @@ local function getAllFiles()
local result = http.post(updateUrl, currentFiles) local result = http.post(updateUrl, currentFiles)
if result == nil then if result == nil then
print("error! getting updates for " .. programToInstall) print("error! getting updates for " .. programToInstall)
error()
end end
local resultText = result.readAll() local resultText = result.readAll()
local resultTable = split(resultText, "\n") local resultTable = split(resultText, "\n")
@ -71,6 +72,7 @@ local function getAllFiles()
local result2 = http.get(indexesUrl) local result2 = http.get(indexesUrl)
if result2 == nil then if result2 == nil then
print("error! getting indexes for " .. programToInstall) print("error! getting indexes for " .. programToInstall)
error()
end end
local resultText2 = result2.readAll() local resultText2 = result2.readAll()
local resultTable2 = split(resultText2, "\n") local resultTable2 = split(resultText2, "\n")