Fix NPE in MarkerProcessor when unnamed markers are present

This commit is contained in:
Jonas Herzig
2019-07-06 12:50:31 +02:00
parent dc86da7a20
commit 67e300bcff

View File

@@ -46,7 +46,7 @@ public class MarkerProcessor {
private static boolean hasWork(Path path) throws IOException { private static boolean hasWork(Path path) throws IOException {
try (ZipReplayFile inputReplayFile = new ZipReplayFile(new ReplayStudio(), path.toFile())) { try (ZipReplayFile inputReplayFile = new ZipReplayFile(new ReplayStudio(), path.toFile())) {
return inputReplayFile.getMarkers().or(HashSet::new).stream().anyMatch(m -> m.getName().startsWith("_RM_")); return inputReplayFile.getMarkers().or(HashSet::new).stream().anyMatch(m -> m.getName() != null && m.getName().startsWith("_RM_"));
} }
} }
@@ -70,7 +70,7 @@ public class MarkerProcessor {
List<Marker> markers = inputReplayFile.getMarkers().or(HashSet::new) List<Marker> markers = inputReplayFile.getMarkers().or(HashSet::new)
.stream().sorted(Comparator.comparing(Marker::getTime)).collect(Collectors.toList()); .stream().sorted(Comparator.comparing(Marker::getTime)).collect(Collectors.toList());
Iterator<Marker> markerIterator = markers.iterator(); Iterator<Marker> markerIterator = markers.iterator();
boolean anySplit = markers.stream().anyMatch(m -> m.getName().equals(MARKER_NAME_SPLIT)); boolean anySplit = markers.stream().anyMatch(m -> MARKER_NAME_SPLIT.equals(m.getName()));
int inputDuration = inputReplayFile.getMetaData().getDuration(); int inputDuration = inputReplayFile.getMetaData().getDuration();
ReplayInputStream replayInputStream = inputReplayFile.getPacketData(studio, true); ReplayInputStream replayInputStream = inputReplayFile.getPacketData(studio, true);