summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/util/unicode.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/util/unicode.cpp')
-rw-r--r--src/lib/util/unicode.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/util/unicode.cpp b/src/lib/util/unicode.cpp
index e07984d05b2..a07da6c7759 100644
--- a/src/lib/util/unicode.cpp
+++ b/src/lib/util/unicode.cpp
@@ -386,8 +386,8 @@ int utf8_from_uchar(char *utf8string, size_t count, char32_t uchar)
std::string utf8_from_uchar(char32_t uchar)
{
char buffer[UTF8_CHAR_MAX];
- auto len = utf8_from_uchar(buffer, std::size(buffer), uchar);
- return std::string(buffer, len);
+ auto const len = utf8_from_uchar(buffer, std::size(buffer), uchar);
+ return std::string(buffer, std::max<decltype(len)>(len, 0));
}