--- android/TrainInfoService/src/dk/thoerup/traininfoservice/banedk/DepartureBean.java 2009/09/30 19:11:52 372 +++ android/TrainInfoService/src/dk/thoerup/traininfoservice/banedk/DepartureBean.java 2009/09/30 19:49:25 373 @@ -62,9 +62,17 @@ @Override public int compareTo(DepartureBean otherBean) { + String timeStr1 = time.replace(":","").trim(); + String timeStr2 = otherBean.time.replace(":","").trim(); - int time1 = Integer.parseInt(time.replace(":", "")); - int time2 = Integer.parseInt(otherBean.time.replace(":", "")); + int time1 = 0; + int time2 = 0; + + if (timeStr1.length() > 0) + time1 = Integer.parseInt(timeStr1); + + if (timeStr2.length() > 0) + time2 = Integer.parseInt(timeStr2); //work correctly when clock wraps around at midnight if (Math.abs(time1-time2) < 1200) {