core: fix warnings in abstract_text
authorAlexandre Terrasa <alexandre@moz-code.org>
Wed, 20 Apr 2016 05:51:50 +0000 (01:51 -0400)
committerAlexandre Terrasa <alexandre@moz-code.org>
Tue, 31 May 2016 23:43:20 +0000 (19:43 -0400)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

lib/core/text/abstract_text.nit

index d7dfa48..ed04967 100644 (file)
@@ -2102,7 +2102,12 @@ end
 # see `alpha_comparator`
 private class AlphaComparator
        super Comparator
-       redef fun compare(a, b) do return a.to_s <=> b.to_s
+       redef fun compare(a, b) do
+               if a == b then return 0
+               if a == null then return -1
+               if b == null then return 1
+               return a.to_s <=> b.to_s
+       end
 end
 
 # Stateless comparator that naively use `to_s` to compare things.