1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-28 12:40:06 +00:00

Handle empty strings.

This commit is contained in:
AnyOldName3 2021-06-26 19:46:34 +01:00
parent 1f658209f8
commit 873b3b4800

View File

@ -95,6 +95,12 @@ class Base64 {
size_t in_len = input.size();
if (in_len % 4 != 0) return "Input data size is not a multiple of 4";
if (in_len == 0)
{
out = "";
return "";
}
size_t out_len = in_len / 4 * 3;
if (input[in_len - 1] == '=') out_len--;
if (input[in_len - 2] == '=') out_len--;