Skip to content

Commit

Permalink
fixes NullPointerException, when using compareTo with locations that …
Browse files Browse the repository at this point in the history
…dont have a URI or position
  • Loading branch information
BookWood7th committed Oct 21, 2024
1 parent 8e28439 commit 3ebff5e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions key.core/src/main/java/de/uka/ilkd/key/parser/Location.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ public int hashCode() {
@Override
public int compareTo(@NonNull Location o) {
return Comparator
.<Location, URI>comparing(l -> l.fileUri)
.thenComparing(Location::getPosition).compare(this, o);
.<Location, URI>comparing(l -> l.fileUri, Comparator.nullsLast(Comparator.naturalOrder()))
.thenComparing(Location::getPosition, Comparator.nullsLast(Comparator.naturalOrder()))
.compare(this, o);
}
}

0 comments on commit 3ebff5e

Please sign in to comment.