Fix fmt::UTF exception for empty strings (#1084)

This commit is contained in:
Vinicius Rangel 2024-09-26 11:21:31 -03:00 committed by GitHub
parent cc279d9dde
commit 04483f779d

View file

@ -26,7 +26,7 @@ struct UTF {
T data;
explicit UTF(const std::u8string_view view) {
data = T{(const char*)&view.front(), (const char*)&view.back() + 1};
data = view.empty() ? T{} : T{(const char*)&view.front(), (const char*)&view.back() + 1};
}
explicit UTF(const std::u8string& str) : UTF(std::u8string_view{str}) {}