File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed
Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -25,17 +25,13 @@ namespace {
2525// !
2626PollWeightType ParseWeightType (const std::string& value)
2727{
28- try {
29- const uint32_t parsed = std::stoul (value);
28+ uint32_t parsed = 0 ;
3029
31- if (parsed > Poll::WeightType::MAX) {
30+ if (!:: ParseUInt32 (value, &parsed) || parsed > Poll::WeightType::MAX) {
3231 return PollWeightType::UNKNOWN;
3332 }
3433
3534 return static_cast <PollWeightType>(parsed);
36- } catch (...) {
37- return PollWeightType::UNKNOWN;
38- }
3935}
4036
4137// !
@@ -48,11 +44,13 @@ PollWeightType ParseWeightType(const std::string& value)
4844// !
4945uint32_t ParseDurationDays (const std::string& value)
5046{
51- try {
52- return std::stoul (value);
53- } catch (... ) {
47+ uint32_t duration = 0 ;
48+
49+ if (!:: ParseUInt32 (value, &duration) ) {
5450 return 0 ;
5551 }
52+
53+ return duration;
5654}
5755
5856// !
You can’t perform that action at this time.
0 commit comments