1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

Fix Marshalls.utf8_to_base64 shows 'ret.is_empty() is true' error for empty String

This commit is contained in:
bleikerja
2025-03-14 23:00:56 +01:00
parent b5bdb88062
commit e6a8c4b43f

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) { String Marshalls::utf8_to_base64(const String &p_str) {
if (p_str.is_empty()) {
return String();
}
CharString cstr = p_str.utf8(); CharString cstr = p_str.utf8();
String ret = CryptoCore::b64_encode_str((unsigned char *)cstr.get_data(), cstr.length()); String ret = CryptoCore::b64_encode_str((unsigned char *)cstr.get_data(), cstr.length());
ERR_FAIL_COND_V(ret.is_empty(), ret); ERR_FAIL_COND_V(ret.is_empty(), ret);