Fixed NPE in task sorting algorithm.

pull/14/head
Tim Su 16 years ago
parent eed464cb31
commit 33ea2a1f43

@ -78,13 +78,6 @@ public class TaskModelForList extends AbstractTaskModel {
private int getWeight() {
int weight = 0;
// bubble completed tasks to the bottom
if(isTaskCompleted()) {
weight += Math.max(5e6 - (System.currentTimeMillis() -
getCompletionDate().getTime()) / 1000, 5000);
return weight;
}
// importance
weight += getImportance().ordinal() * 60;
@ -109,6 +102,16 @@ public class TaskModelForList extends AbstractTaskModel {
weight += (hoursLeft - 5*24)/2;
}
// bubble completed tasks to the bottom
if(isTaskCompleted()) {
if(getCompletionDate() == null)
weight += 5e6;
else
weight = (int)Math.max(5e6 - (System.currentTimeMillis() -
getCompletionDate().getTime()) / 1000, 5000);
return weight;
}
return weight;
}

Loading…
Cancel
Save