From e6a8c4b43f365a0588c6d12246d7f9afa38c406a Mon Sep 17 00:00:00 2001 From: bleikerja Date: Fri, 14 Mar 2025 23:00:56 +0100 Subject: [PATCH] Fix Marshalls.utf8_to_base64 shows 'ret.is_empty() is true' error for empty String --- core/core_bind.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/core_bind.cpp b/core/core_bind.cpp index cc7bb646d80..8b2de00c193 100644 --- a/core/core_bind.cpp +++ b/core/core_bind.cpp @@ -1241,6 +1241,9 @@ Vector 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);