浏览代码

add null check

AndyScherzinger 7 年之前
父节点
当前提交
e55f0e43b9
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      src/main/java/third_parties/daveKoeller/AlphanumComparator.java

+ 5 - 0
src/main/java/third_parties/daveKoeller/AlphanumComparator.java

@@ -105,6 +105,11 @@ public class AlphanumComparator<T> implements Comparator<T>, Serializable {
     }
 
     public int compare(String s1, String s2) {
+        if ((s1 == null) || (s2 == null))
+        {
+            return 0;
+        }
+        
         int thisMarker = 0;
         int thatMarker = 0;
         int s1Length = s1.length();