From 13d9cd4914e89ce6fe3f5c8acf106ac70dee9bf1 Mon Sep 17 00:00:00 2001 From: Jamie Hardt Date: Thu, 17 Sep 2026 09:57:52 -0700 Subject: [PATCH] Added tests to audioStreamFormat parsing ASF's may have zero or one channelformatrefs or packformatrefs. We were expecting one. --- src/wavinfo/wave_adm_reader.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/wavinfo/wave_adm_reader.py b/src/wavinfo/wave_adm_reader.py index 665aa73..c0ff3a7 100644 --- a/src/wavinfo/wave_adm_reader.py +++ b/src/wavinfo/wave_adm_reader.py @@ -134,13 +134,17 @@ class WavADMReader: ("audioStreamFormat[@audioStreamFormatID='%s']" "/audioChannelFormatIDRef") % stream_id, namespaces=nsmap) - channelformat_id = channelformatref_elem.text + + if channelformatref_elem: + channelformat_id = channelformatref_elem.text packformatref_elem = afext.find( ("audioStreamFormat[@audioStreamFormatID='%s']" "/audioPackFormatIDRef") % stream_id, namespaces=nsmap) - packformat_id = packformatref_elem.text + + if packformatref_elem: + packformat_id = packformatref_elem.text channelformat_elem = afext\ .find("audioChannelFormat[@audioChannelFormatID='%s']"