diff --git a/.vscode/settings.json b/.vscode/settings.json index cbf1801..3e75259 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -42,5 +42,5 @@ "_VERSION", "_" ], - "Lua.runtime.version": "Lua 5.1", + "Lua.runtime.version": "Lua 5.4", } \ No newline at end of file diff --git a/CardLayout.lua b/CardLayout.lua index 5423272..c0c8173 100644 --- a/CardLayout.lua +++ b/CardLayout.lua @@ -33,7 +33,10 @@ local categories = renderHelpers.getCategories(props.shopState.products) local selectedCategory = props.shopState.selectedCategory - local shopProducts = renderHelpers.getDisplayedProducts(categories[selectedCategory].products, props.configState.config.settings) + local shopProducts = {} + if categories[selectedCategory] then + shopProducts = renderHelpers.getDisplayedProducts(categories[selectedCategory].products, props.configState.config.settings) + end local currency = props.shopState.selectedCurrency local headerSuffix = "" diff --git a/DefaultLayout.lua b/DefaultLayout.lua index 30572df..40d1b84 100644 --- a/DefaultLayout.lua +++ b/DefaultLayout.lua @@ -135,8 +135,12 @@ local maxPriceWidth = 0 local maxNameWidth = 0 props.shopState.numCategories = #categories - local catName = categories[selectedCategory].name - local shopProducts = renderHelpers.getDisplayedProducts(categories[selectedCategory].products, props.configState.config.settings) + local catName = "*" + local shopProducts = {} + if categories[selectedCategory] then + catName = categories[selectedCategory].name + shopProducts = renderHelpers.getDisplayedProducts(categories[selectedCategory].products, props.configState.config.settings) + end local productsHeight = display.bgCanvas.height - headerHeight - footerHeight - 2 local heightPerProduct = math.floor(productsHeight / #shopProducts) local layout @@ -154,7 +158,7 @@ local currency = props.shopState.selectedCurrency local currencySymbol = renderHelpers.getCurrencySymbol(currency, layout) - while maxAddrWidth == 0 or maxAddrWidth + maxQtyWidth + maxPriceWidth + maxNameWidth > display.bgCanvas.width - 3 do + while #shopProducts > 0 and (maxAddrWidth == 0 or maxAddrWidth + maxQtyWidth + maxPriceWidth + maxNameWidth > display.bgCanvas.width - 3) do if props.configState.config.theme.formatting.layout == "auto" and (maxAddrWidth + maxQtyWidth + maxPriceWidth + maxNameWidth > display.bgCanvas.width - 3) then if layout == "large" then layout = "medium" diff --git a/radon.lua b/radon.lua index aaa58fc..9b1f50d 100644 --- a/radon.lua +++ b/radon.lua @@ -1,4 +1,4 @@ -local version = "1.3.21" +local version = "1.3.22" local configHelpers = require "util.configHelpers" local schemas = require "core.schemas" local oldPullEvent = os.pullEvent