Skip to content

Commit

Permalink
Prevent some IOExceptions when past the end of stream.
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-signal authored and alex-signal committed May 14, 2020
1 parent a510bc7 commit 1778c1e
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ final class ModernEncryptedMediaDataSource extends MediaDataSource {

@Override
public int readAt(long position, byte[] bytes, int offset, int length) throws IOException {
if (position >= this.length) {
return -1;
}

try (InputStream inputStream = createInputStream(position)) {
int totalRead = 0;

Expand Down

0 comments on commit 1778c1e

Please sign in to comment.