Skip to content

Commit f12d374

Browse files
committedDec 26, 2018
Content store: Fix bugs relating to packages list size
1 parent a5197ea commit f12d374

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed
 

‎builtin/mainmenu/dlg_contentstore.lua

+9-3
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ function store.load()
285285

286286
local file = io.open(target, "r")
287287
if file then
288-
store.packages_full = core.parse_json(file:read("*all"))
288+
store.packages_full = core.parse_json(file:read("*all")) or {}
289289
file:close()
290290

291291
for _, package in pairs(store.packages_full) do
@@ -385,7 +385,7 @@ function store.get_formspec()
385385
end
386386

387387
local formspec
388-
if #store.packages > 0 then
388+
if #store.packages_full > 0 then
389389
formspec = {
390390
"size[12,7;true]",
391391
"position[0.5,0.55]",
@@ -426,6 +426,12 @@ function store.get_formspec()
426426
}
427427
end
428428

429+
if #store.packages == 0 then
430+
formspec[#formspec + 1] = "label[4,3;"
431+
formspec[#formspec + 1] = fgettext("No results")
432+
formspec[#formspec + 1] = "]"
433+
end
434+
429435
local start_idx = (cur_page - 1) * num_per_page + 1
430436
for i=start_idx, math.min(#store.packages, start_idx+num_per_page-1) do
431437
local package = store.packages[i]
@@ -570,7 +576,7 @@ function store.handle_submit(this, fields, tabname, tabdata)
570576
end
571577

572578
function create_store_dlg(type)
573-
if not store.loaded then
579+
if not store.loaded or #store.packages_full == 0 then
574580
store.load()
575581
end
576582

0 commit comments

Comments
 (0)