mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Added error check for zero divide
This commit is contained in:
parent
bb88e61682
commit
3552a928dd
@ -287,7 +287,7 @@ bool CConfigParser::GetSectionVariable(std::wstring& strVariable, std::wstring&
|
|||||||
CMeasure* measure = m_MeterWindow->GetMeasure(strVariable);
|
CMeasure* measure = m_MeterWindow->GetMeasure(strVariable);
|
||||||
if (measure)
|
if (measure)
|
||||||
{
|
{
|
||||||
double scale = 1.0;
|
int scale = 1;
|
||||||
|
|
||||||
const WCHAR* decimalsSz = wcschr(selectorSz, L',');
|
const WCHAR* decimalsSz = wcschr(selectorSz, L',');
|
||||||
if (decimalsSz)
|
if (decimalsSz)
|
||||||
@ -308,9 +308,9 @@ bool CConfigParser::GetSectionVariable(std::wstring& strVariable, std::wstring&
|
|||||||
{
|
{
|
||||||
errno = 0;
|
errno = 0;
|
||||||
scale = _wtoi(selectorSz + 1);
|
scale = _wtoi(selectorSz + 1);
|
||||||
if (errno == EINVAL)
|
if (errno == EINVAL || scale == 0) // Invalid scale value
|
||||||
{
|
{
|
||||||
scale = 1.0;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user