Commits

haypo  committed db9995d

Metadata AIFF: avoid division per zero

  • Participants
  • Parent commits 3b6e15c

Comments (0)

Files changed (1)

File hachoir-metadata/hachoir_metadata/audio.py

         if "common" in aiff:
             info = aiff["common"]
             rate = int(info["sample_rate"].value)
-            self.sample_rate = rate
-            self.duration = info["nb_sample"].value * 1000 / rate
+            if rate:
+                self.sample_rate = rate
+                self.duration = info["nb_sample"].value * 1000 // rate
             self.nb_channel = info["nb_channel"].value
             self.bits_per_sample = info["sample_size"].value
             if "codec" in info: