Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,10 @@ public ModeSDownlinkMsg decode(String raw_message, boolean noCRC, long timestamp
* @return decoded WGS84 position
*/
public Position extractPosition(ModeSDownlinkMsg.QualifiedAddress address, PositionMsg msg, Position receiver) {
if (!msg.hasValidPosition()) {
return null;
}

DecoderData dd = getDecoderData(address);
Position pos = dd.posDec.decodePosition(msg.getCPREncodedPosition(), receiver);

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/de/serosystems/lib1090/msgs/PositionMsg.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ public interface PositionMsg {
boolean hasValidPosition();

/**
* @return the CPR encoded position that was announced in this message
* @return the CPR encoded position that was announced in this message.
* The method may return an invalid position if #hasValidPosition() is false.
*/
CPREncodedPosition getCPREncodedPosition();

Expand Down