From f00d7bb505bb65c2104957483b4fa4fc9a4ed14f Mon Sep 17 00:00:00 2001 From: Sokomine Date: Wed, 5 Jan 2022 23:44:30 +0100 Subject: [PATCH] deal with missing sort_by parameter --- functions.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/functions.lua b/functions.lua index e8e4789..8a5517c 100644 --- a/functions.lua +++ b/functions.lua @@ -1077,8 +1077,12 @@ yl_speak_up.get_sorted_options = function(options, sort_by) end table.sort(sorted_list, function(a,b) + if(not(options[a][sort_by])) then + return false + elseif(not(options[b][sort_by])) then + return true -- sadly not all entries are numeric - if(tonumber(options[a][sort_by]) and tonumber(options[b][sort_by])) then + elseif(tonumber(options[a][sort_by]) and tonumber(options[b][sort_by])) then return (tonumber(options[a][sort_by]) < tonumber(options[b][sort_by])) -- numbers have a higher priority elseif(tonumber(options[a][sort_by])) then