Skip to content

Commit

Permalink
removeFrame method now ignores the request if the calculated expected…
Browse files Browse the repository at this point in the history
… frames to remove is equal to zero
  • Loading branch information
falahati committed Nov 1, 2017
1 parent 6467616 commit 33ffe2c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/MpegAudio.php
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,9 @@ public function removeFrame($index, $count = 1) {
return $this;
}
$count = min($this->getFrameCounts() - $index, $count);

if ($count == 0) {
return $this;
}
$firstFrameHeader = $this->getFrameHeader($index);
$lastFrameHeader = $this->getFrameHeader($index + ($count - 1));
$this->slice(($lastFrameHeader->getOffset() + $lastFrameHeader->getLength()) - $firstFrameHeader->getOffset(), $firstFrameHeader->getOffset());
Expand Down

0 comments on commit 33ffe2c

Please sign in to comment.