Skip to content

Commit 7e50dab

Browse files
mnoiyxiaoxial
authored andcommitted
add codes to treat negative values
1 parent 5db9c1a commit 7e50dab

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

Library/Raisr.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,14 @@ RNLERRORTYPE RNLStoi(unsigned int *pValue, const char *configContent, std::strin
174174
{
175175
try
176176
{
177-
*pValue = std::stoi(configContent);
177+
int tmp;
178+
tmp = std::stoi(configContent);
179+
if (tmp < 0)
180+
{
181+
std::cout << "[RAISR ERROR] configFile corrupted: " << configPath << std::endl;
182+
return RNLErrorBadParameter;
183+
}
184+
*pValue = tmp;
178185
return RNLErrorNone;
179186
}
180187
catch (const std::invalid_argument &ia)

0 commit comments

Comments
 (0)