Skip to content

Commit f1979e2

Browse files
committed
fixes
1 parent f3e866e commit f1979e2

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

include/behaviortree_cpp/utils/convert_impl.hpp

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -154,18 +154,11 @@ void convertNumber(const SRC& source, DST& target)
154154
throw std::runtime_error("Value is negative and can't be converted to unsigned");
155155
}
156156
}
157-
// these conversions are always safe:
158-
// - same type
159-
// - float -> double
160-
if constexpr(is_same<SRC, DST>() || (is_same<SRC, float>() && is_same<DST, double>()))
157+
// these conversions are always safe: // No check needed
158+
if constexpr(is_same<SRC, DST>() || // same type
159+
(is_same<SRC, float>() && is_same<DST, double>()) || // float -> double
160+
(is_convertible_to_bool<SRC>() && is_same<DST, bool>()))
161161
{
162-
// No check needed
163-
target = static_cast<DST>(source);
164-
}
165-
// conversion to bool requires validation (only 0 and 1 allowed)
166-
else if constexpr(is_convertible_to_bool<SRC>() && is_same<DST, bool>())
167-
{
168-
checkLowerLimit<SRC, DST>(source);
169162
target = static_cast<DST>(source);
170163
}
171164
else if constexpr(both_integers)

include/behaviortree_cpp/utils/simple_string.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class SimpleString
2020
public:
2121
SimpleString()
2222
{
23+
_storage.soo.capacity_left = CAPACITY;
2324
_storage.soo.data[0] = '\0';
2425
}
2526

0 commit comments

Comments
 (0)