diff --git a/cuebot/src/main/java/com/imageworks/spcue/dispatcher/DispatchSupportService.java b/cuebot/src/main/java/com/imageworks/spcue/dispatcher/DispatchSupportService.java index 713f6c86c..bde4732b9 100644 --- a/cuebot/src/main/java/com/imageworks/spcue/dispatcher/DispatchSupportService.java +++ b/cuebot/src/main/java/com/imageworks/spcue/dispatcher/DispatchSupportService.java @@ -367,6 +367,12 @@ public RunFrame prepareRqdRunFrame(VirtualProc proc, DispatchFrame frame) { FrameSet fs = new FrameSet(frame.range); int startFrameIndex = fs.index(frameNumber); String frameSpec = fs.getChunk(startFrameIndex, frame.chunkSize); + int lastFrameIndex = fs.size() - 1; + int endChunkIndex = startFrameIndex + frame.chunkSize - 1; + if (endChunkIndex > lastFrameIndex) { + endChunkIndex = lastFrameIndex; + } + RunFrame.Builder builder = RunFrame.newBuilder() .setShot(frame.shot) @@ -409,7 +415,7 @@ public RunFrame prepareRqdRunFrame(VirtualProc proc, DispatchFrame frame) { .replaceAll("#ZFRAME#", zFrameNumber) .replaceAll("#IFRAME#", String.valueOf(frameNumber)) .replaceAll("#FRAME_START#", String.valueOf(frameNumber)) - .replaceAll("#FRAME_END#", String.valueOf(frameNumber+frame.chunkSize-1)) + .replaceAll("#FRAME_END#", String.valueOf(endChunkIndex)) .replaceAll("#FRAME_CHUNK#", String.valueOf(frame.chunkSize)) .replaceAll("#LAYER#", frame.layerName) .replaceAll("#JOB#", frame.jobName)