From d2b0c68dd2cf4473c63a525ed7607d3bc4ba5b21 Mon Sep 17 00:00:00 2001 From: Jamie Hardt Date: Sun, 24 Nov 2024 15:04:00 -0800 Subject: [PATCH] Made sampler udata field nullable --- wavinfo/wave_smpl_reader.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/wavinfo/wave_smpl_reader.py b/wavinfo/wave_smpl_reader.py index 39b2b94..b520c54 100644 --- a/wavinfo/wave_smpl_reader.py +++ b/wavinfo/wave_smpl_reader.py @@ -93,9 +93,12 @@ class WavSmplReader: repetition_count=unpacked_loop[5])) #: Sampler-specific user data. - self.sampler_udata: bytes = smpl_data[ - header_size + loop_size * loop_count: - header_size + loop_size * loop_count + sampler_udata_length] + self.sampler_udata: bytes | None = None + + if sampler_udata_length > 0: + self.sampler_udata = smpl_data[ + header_size + loop_size * loop_count: + header_size + loop_size * loop_count + sampler_udata_length] def to_dict(self): return {