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 1d23f40e02
commit b7e2903911
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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}) {}