Skip to content

Commit 54f15ad

Browse files
committed
fix crash when space age is not installed
1 parent 8538fd9 commit 54f15ad

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

control.lua

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ end
3333

3434
table.sort(quality_list, function(a, b) return a.level <= b.level end)
3535

36+
local has_quality = #quality_list > 0
37+
3638
-- normal, uncommon, rare, epic, (unused in vanilla), legendary
3739
local vanilla_quality_multipliers = {1, 2.1, 4.8, 10.5, 22, 35}
3840

@@ -498,7 +500,7 @@ local function update_menu_trader( player, player_mem, update_orders )
498500
if update_orders then
499501
clean_gui(player_mem.scr_blkmkt_trader_orders)
500502
local gui2
501-
if trader.type == trader_type.item then
503+
if has_quality and trader.type == trader_type.item then
502504
gui2 = player_mem.scr_blkmkt_trader_orders.add({type = "table", name = "tab_blkmkt_trader_orders", column_count = 5, style = "table_blkmkt_style"})
503505
else
504506
gui2 = player_mem.scr_blkmkt_trader_orders.add({type = "table", name = "tab_blkmkt_trader_orders", column_count = 4, style = "table_blkmkt_style"})
@@ -508,7 +510,7 @@ local function update_menu_trader( player, player_mem, update_orders )
508510
gui2.add({type = "label", caption = "name", style = "label_blkmkt_style"})
509511
gui2.add({type = "label", caption = "count", style = "label_blkmkt_style"})
510512
gui2.add({type = "label", caption = "price", style = "label_blkmkt_style"})
511-
if trader.type == trader_type.item then
513+
if has_quality and trader.type == trader_type.item then
512514
gui2.add({type = "label", caption = "quality", style = "label_blkmkt_style"})
513515
end
514516

@@ -541,7 +543,7 @@ local function update_menu_trader( player, player_mem, update_orders )
541543
gui2.add({type = "textfield", name = "but_blkmkt_orc_" .. string.format("%4d",n) .. name, text = count, style = "textfield_blkmkt_style"})
542544
gui2.add({type = "label", caption = format_money(current) .. " " .. format_evolution(evol), style = "label_blkmkt_style"})
543545

544-
if quality then
546+
if has_quality and quality then
545547
gui3 = gui2.add({type = "drop-down", name = "dpn_blkmkt_qlt_" .. string.format("%4d",n) .. name})
546548

547549
for _, proto in ipairs(quality_list) do

0 commit comments

Comments
 (0)