Skip to content

Commit

Permalink
check that bytes to read isn't equal 0
Browse files Browse the repository at this point in the history
Co-authored-by: Borewit <Borewit@users.noreply.github.com>
  • Loading branch information
Araxeus and Borewit committed Aug 7, 2024
1 parent 6dc0a6d commit f0b1dec
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/FileTokenizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class FileTokenizer extends AbstractTokenizer {
public async readBuffer(uint8Array: Uint8Array, options?: IReadChunkOptions): Promise<number> {
const normOptions = this.normalizeOptions(uint8Array, options);
this.position = normOptions.position;
if (!normOptions.length) return 0;
if (normOptions.length === 0) return 0;
const res = await this.fileHandle.read(uint8Array, normOptions.offset, normOptions.length, normOptions.position);
this.position += res.bytesRead;
if (res.bytesRead < normOptions.length && (!options || !options.mayBeLess)) {
Expand Down

0 comments on commit f0b1dec

Please sign in to comment.