diff --git a/server/home/home-common/src/main/java/io/holoinsight/server/home/common/service/query/QueryDetailResponse.java b/server/home/home-common/src/main/java/io/holoinsight/server/home/common/service/query/QueryDetailResponse.java index 06e889563..5fcb7583e 100644 --- a/server/home/home-common/src/main/java/io/holoinsight/server/home/common/service/query/QueryDetailResponse.java +++ b/server/home/home-common/src/main/java/io/holoinsight/server/home/common/service/query/QueryDetailResponse.java @@ -74,8 +74,19 @@ public void sort(String order, String... priorities) { } int finalIndex = index; values.sort((o1, o2) -> { - Double d1 = Double.parseDouble(String.valueOf(o1[finalIndex])); - Double d2 = Double.parseDouble(String.valueOf(o2[finalIndex])); + Double d1; + Double d2; + if (o1.length <= finalIndex) { + d1 = Double.MIN_VALUE; + } else { + d1 = Double.parseDouble(String.valueOf(o1[finalIndex])); + } + if (o2.length <= finalIndex) { + d2 = Double.MIN_VALUE; + } else { + d2 = Double.parseDouble(String.valueOf(o2[finalIndex])); + } + if (StringUtils.equalsIgnoreCase(order, "asc")) { return d1.compareTo(d2); } else {