File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
7
7
## [ Unreleased]
8
8
9
+ ### Fixed
10
+ - ** MusePack** : Fix potential panic when the beginning silence makes up the entire sample count ([ PR] ( https://github.com/Serial-ATA/lofty-rs/pull/449 ) )
11
+
9
12
## [ 0.21.1] - 2024-08-28
10
13
11
14
### Changed
Original file line number Diff line number Diff line change @@ -278,6 +278,14 @@ pub(super) fn read(
278
278
}
279
279
280
280
let total_samples = sample_count - beginning_silence;
281
+ if total_samples == 0 {
282
+ log:: warn!(
283
+ "Sample count (after removing beginning silence) is 0, unable to calculate duration \
284
+ and bitrate"
285
+ ) ;
286
+ return Ok ( properties) ;
287
+ }
288
+
281
289
let length = ( total_samples * 1000 ) . div_round ( u64:: from ( sample_rate) ) ;
282
290
283
291
properties. duration = Duration :: from_millis ( length) ;
You can’t perform that action at this time.
0 commit comments