Merge pull request #104155 from bleikerja/utf8_to_base64_empty_string_fix

Fix `Marshalls.utf8_to_base64` shows `"ret.is_empty()" is true` error for empty string
This commit is contained in:
Rémi Verschelde
2025-03-21 13:03:28 +01:00

View File

@ -1241,6 +1241,9 @@ Vector<uint8_t> Marshalls::base64_to_raw(const String &p_str) {
}
String Marshalls::utf8_to_base64(const String &p_str) {
if (p_str.is_empty()) {
return String();
}
CharString cstr = p_str.utf8();
String ret = CryptoCore::b64_encode_str((unsigned char *)cstr.get_data(), cstr.length());
ERR_FAIL_COND_V(ret.is_empty(), ret);