diff --git a/libuavcan/include/uavcan/marshal/char_array_formatter.hpp b/libuavcan/include/uavcan/marshal/char_array_formatter.hpp index 76c3948ad0..e805f162a4 100644 --- a/libuavcan/include/uavcan/marshal/char_array_formatter.hpp +++ b/libuavcan/include/uavcan/marshal/char_array_formatter.hpp @@ -85,11 +85,15 @@ public: { while (s && *s) { - if (*s == '%' && *++s != '%') + if (*s == '%') { - writeValue(value); - write(++s, args...); - break; + s += 1; + if (*s != '%') + { + writeValue(value); + write(++s, args...); + break; + } } writeValue(*s++); }