From 848998003939d1617dad649dc9842b11ffc83ead Mon Sep 17 00:00:00 2001 From: sapier Date: Sun, 25 Aug 2013 00:43:20 +0200 Subject: [PATCH] Add sanity check to sort function --- builtin/filterlist.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/builtin/filterlist.lua b/builtin/filterlist.lua index fd337ae9..1c2ceb03 100644 --- a/builtin/filterlist.lua +++ b/builtin/filterlist.lua @@ -240,6 +240,12 @@ end function sort_worlds_alphabetic(this) table.sort(this.m_processed_list, function(a, b) + --fixes issue #857 (crash due to sorting nil in worldlist) + if a == nil or b == nil then + if a == nil and b ~= nil then return false end + if b == nil and a ~= nil then return true end + return false + end if a.name:lower() == b.name:lower() then return a.name < b.name end