Permalink
Browse files

Added error check for zero divide

  • Loading branch information...
1 parent bb88e61 commit 3552a928ddf503f29f14cac1a2e35d36414984f2 @spx268 spx268 committed Mar 8, 2013
Showing with 3 additions and 3 deletions.
  1. +3 −3 Library/ConfigParser.cpp
@@ -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

0 comments on commit 3552a92

Please sign in to comment.