diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-11-04 23:42:19 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-11-05 01:04:43 +0100 |
commit | b8627a7d786d53e42dbad87a9eef87589dff0d16 (patch) | |
tree | b7dba3b78498f31c88a2f1d9fb3a1b65d2275e4d | |
parent | bb1a91f129800af25d198df10d033a01b99e0f6a (diff) |
ccc
-rw-r--r-- | compat/format.hpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/compat/format.hpp b/compat/format.hpp index 9a61dd96..741b35bd 100644 --- a/compat/format.hpp +++ b/compat/format.hpp @@ -1,4 +1,5 @@ #pragma once +#include "compat/assert.hpp" #include <fmt/core.h> #include <fmt/compile.h> #include <Corrade/Containers/StringView.h> @@ -54,6 +55,7 @@ size_t snformat(char(&buf)[N], Fmt&& fmt, Xs&&... args) constexpr size_t n = N > 0 ? N - 1 : 0; auto result = fmt::format_to_n(buf, n, Corrade::Utility::forward<Fmt>(fmt), Corrade::Utility::forward<Xs>(args)...); const auto len = Utility::min(n, result.size); + fm_assert(len > 0); if constexpr(N > 0) buf[len] = '\0'; return len; |