Skip to content

Commit

Permalink
improve handling of non-numeric values in isNumber<T>
Browse files Browse the repository at this point in the history
previously, an exception was thrown and caught when isNumber<T> was
called on a non-numeric Slice.
now, this exception is avoided and the case is handled with a simple
initial value type check instead.
  • Loading branch information
jsteemann committed Jul 25, 2024
1 parent 4e7f1f0 commit 8e10d8f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/velocypack/SliceBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,9 @@ struct SliceBase {
// number type
template<typename T>
bool isNumber() const noexcept {
if (!isInteger() && !isDouble()) {
return false;
}
try {
if constexpr (std::is_integral_v<T>) {
if constexpr (std::is_signed_v<T>) {
Expand Down

0 comments on commit 8e10d8f

Please sign in to comment.