Skip to content

Commit 8248adb

Browse files
committed
Check for buffer < len to find EOF.
1 parent 85432e7 commit 8248adb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

crates/bevy_asset/src/meta.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,11 @@ pub(crate) async fn get_asset_hash(
253253
let mut buffer = [0; blake3::CHUNK_LEN];
254254
loop {
255255
let bytes_read = asset_reader.read(&mut buffer).await?;
256-
if bytes_read == 0 {
257-
// This means we've reached EOF, so we're done consume asset bytes.
256+
hasher.update(&buffer[..bytes_read]);
257+
if bytes_read < buffer.len() {
258+
// This means we've reached EOF, so we're done consuming asset bytes.
258259
break;
259260
}
260-
hasher.update(&buffer[..bytes_read]);
261261
}
262262
Ok(*hasher.finalize().as_bytes())
263263
}

0 commit comments

Comments
 (0)