Permalink
Browse files

fixed: avoid potential division by zero

  • Loading branch information...
1 parent ea07b8e commit 0211f4a1a84160257ed38aa333ab6b95e3dac4ff spiff committed Feb 13, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 xbmc/music/tags/FlacTag.cpp
@@ -182,7 +182,8 @@ int CFlacTag::ReadFlacHeader(void)
m_file->Read(buffer, 8); // read 64 bits of data
int iFreq = (buffer[0] << 12) | (buffer[1] << 4) | (buffer[2] >> 4);
int64_t iNumSamples = ( (int64_t) (buffer[3] & 0x0F) << 32) | ( (int64_t) buffer[4] << 24) | (buffer[5] << 16) | (buffer[6] << 8) | buffer[7];
- m_musicInfoTag.SetDuration((int)((iNumSamples) / iFreq));
+ if (iFreq != 0)
+ m_musicInfoTag.SetDuration((int)((iNumSamples) / iFreq));
return iPos + 38;
}

0 comments on commit 0211f4a

Please sign in to comment.