Skip to content

Commit 7bf277c

Browse files
committed
Value: Fix output of conversion functions
1 parent 989d6c1 commit 7bf277c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/scratch/value.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ double Value::stringToDouble(const std::string &s, bool *ok)
162162
*ok = true;
163163
return std::stod(s);
164164
} catch (...) {
165+
if (ok)
166+
*ok = false;
165167
return 0;
166168
}
167169
}
@@ -190,6 +192,8 @@ long Value::stringToLong(const std::string &s, bool *ok)
190192
*ok = true;
191193
return std::stol(s);
192194
} catch (...) {
195+
if (ok)
196+
*ok = false;
193197
return 0;
194198
}
195199
}

0 commit comments

Comments
 (0)