diff options
author | sapier <Sapier at GMX dot net> | 2013-08-25 00:43:20 +0200 |
---|---|---|
committer | Kahrl <kahrl@gmx.net> | 2013-09-05 01:45:39 +0200 |
commit | 848998003939d1617dad649dc9842b11ffc83ead (patch) | |
tree | d7977745c0727af52fbc2f17228fb9e96336af25 /builtin | |
parent | 7935044820a02817cd5483be32ec82c2fe47a550 (diff) | |
download | minetest-848998003939d1617dad649dc9842b11ffc83ead.tar.gz minetest-848998003939d1617dad649dc9842b11ffc83ead.tar.bz2 minetest-848998003939d1617dad649dc9842b11ffc83ead.zip |
Add sanity check to sort function
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/filterlist.lua | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/builtin/filterlist.lua b/builtin/filterlist.lua index fd337ae92..1c2ceb031 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 |