Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added error check for zero divide

  • Loading branch information...
commit 3552a928ddf503f29f14cac1a2e35d36414984f2 1 parent bb88e61
@spx268 spx268 authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 Library/ConfigParser.cpp
View
6 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
Please sign in to comment.
Something went wrong with that request. Please try again.