Add sanity check to sort function
authorsapier <Sapier at GMX dot net>
Sat, 24 Aug 2013 22:43:20 +0000 (00:43 +0200)
committerKahrl <kahrl@gmx.net>
Wed, 4 Sep 2013 23:45:39 +0000 (01:45 +0200)
builtin/filterlist.lua

index fd337ae92161d61fc4a3252c8e2445bfb8993d85..1c2ceb0316eeccb6dd4928cc815f2e2efd210333 100644 (file)
@@ -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