Added error check for zero divide

This commit is contained in:
spx 2013-03-09 02:39:17 +09:00
parent bb88e61682
commit 3552a928dd

View File

@ -287,7 +287,7 @@ bool CConfigParser::GetSectionVariable(std::wstring& strVariable, std::wstring&
CMeasure* measure = m_MeterWindow->GetMeasure(strVariable);
if (measure)
{
double scale = 1.0;
int scale = 1;
const WCHAR* decimalsSz = wcschr(selectorSz, L',');
if (decimalsSz)
@ -308,9 +308,9 @@ bool CConfigParser::GetSectionVariable(std::wstring& strVariable, std::wstring&
{
errno = 0;
scale = _wtoi(selectorSz + 1);
if (errno == EINVAL)
if (errno == EINVAL || scale == 0) // Invalid scale value
{
scale = 1.0;
return false;
}
}
else