Skip to content

Commit

Permalink
Fix NPE when pcrPID not present
Browse files Browse the repository at this point in the history
  • Loading branch information
EricBerendsen committed May 20, 2024
1 parent c0090c8 commit d498b22
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*
* http://www.digitalekabeltelevisie.nl/dvb_inspector
*
* This code is Copyright 2009-2019 by Eric Berendsen (e_berendsen@digitalekabeltelevisie.nl)
* This code is Copyright 2009-2024 by Eric Berendsen (e_berendsen@digitalekabeltelevisie.nl)
*
* This file is part of DVB Inspector.
*
Expand Down Expand Up @@ -102,7 +102,7 @@ public DefaultMutableTreeNode getJTreeNode(int modus) {
private String getPreRollTimeString() {
if (time_specified_flag == 1) {
PID parentPid = getParentPID();
if(parentPid == null) {
if (parentPid == null) {
return "";
}
TransportStream ts = parentPid.getParentTransportStream();
Expand All @@ -112,12 +112,14 @@ private String getPreRollTimeString() {
if (pmtList.size() >= 1) {
PMTsection pmt = pmtList.get(0);
PID pcrPid = ts.getPID(pmt.getPcrPid());
if (pcrPid != null) {

Long packetPcrTime = pcrPid.getPacketPcrTime(getFirst_packet_no()); // 27 Mhz
if (packetPcrTime != null) {
// ptsTime = 90 kHz clock
double preRollSecs = ((double) (getSpliceTimeAdjusted() - (packetPcrTime / 300))) / 90_000L;
return String.format(" (preroll time = %3.3f secs)", preRollSecs);
Long packetPcrTime = pcrPid.getPacketPcrTime(getFirst_packet_no()); // 27 Mhz
if (packetPcrTime != null) {
// ptsTime = 90 kHz clock
double preRollSecs = ((double) (getSpliceTimeAdjusted() - (packetPcrTime / 300))) / 90_000L;
return String.format(" (preroll time = %3.3f secs)", preRollSecs);
}
}
}
}
Expand Down

0 comments on commit d498b22

Please sign in to comment.