Prevent creation of negative length replays
This commit is contained in:
@@ -38,9 +38,15 @@ public class StudioImplementation {
|
|||||||
ReplayFile replayFile = new ZipReplayFile(studio, file);
|
ReplayFile replayFile = new ZipReplayFile(studio, file);
|
||||||
|
|
||||||
ReplayMetaData metaData = replayFile.getMetaData();
|
ReplayMetaData metaData = replayFile.getMetaData();
|
||||||
|
if (beginning > metaData.getDuration()) {
|
||||||
|
beginning = metaData.getDuration();
|
||||||
|
}
|
||||||
if (ending == 0) {
|
if (ending == 0) {
|
||||||
ending = metaData.getDuration();
|
ending = metaData.getDuration();
|
||||||
}
|
}
|
||||||
|
if (ending < beginning) {
|
||||||
|
ending = beginning;
|
||||||
|
}
|
||||||
|
|
||||||
PacketStream stream = studio.createReplayStream(replayFile.getPacketData(), true);
|
PacketStream stream = studio.createReplayStream(replayFile.getPacketData(), true);
|
||||||
stream.addFilter(new ProgressFilter(metaData.getDuration(), updateListener, 1/100f, 9/10f));
|
stream.addFilter(new ProgressFilter(metaData.getDuration(), updateListener, 1/100f, 9/10f));
|
||||||
|
|||||||
Reference in New Issue
Block a user