Don't crash if the descriptor's sampling rate denominator is 0.
authorCarl Hetherington <cth@carlh.net>
Fri, 17 Feb 2023 20:27:28 +0000 (21:27 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 17 Feb 2023 20:27:28 +0000 (21:27 +0100)
src/sound_asset.cc

index 0eaa8fb50f69269c66b86b37e428a4f0e0368707..e24aced20a27252efb8caabd74d036be53b13ef4 100644 (file)
@@ -78,7 +78,7 @@ SoundAsset::SoundAsset (boost::filesystem::path file)
                boost::throw_exception (ReadError("could not read audio MXF information"));
        }
 
-       _sampling_rate = desc.AudioSamplingRate.Numerator / desc.AudioSamplingRate.Denominator;
+       _sampling_rate = desc.AudioSamplingRate.Denominator ? (desc.AudioSamplingRate.Numerator / desc.AudioSamplingRate.Denominator) : 0;
        _channels = desc.ChannelCount;
        _edit_rate = Fraction (desc.EditRate.Numerator, desc.EditRate.Denominator);