mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 21:07:59 +03:00
Handle empty strings.
This commit is contained in:
parent
1f658209f8
commit
873b3b4800
1 changed files with 6 additions and 0 deletions
6
extern/Base64/Base64.h
vendored
6
extern/Base64/Base64.h
vendored
|
@ -95,6 +95,12 @@ class Base64 {
|
||||||
size_t in_len = input.size();
|
size_t in_len = input.size();
|
||||||
if (in_len % 4 != 0) return "Input data size is not a multiple of 4";
|
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;
|
size_t out_len = in_len / 4 * 3;
|
||||||
if (input[in_len - 1] == '=') out_len--;
|
if (input[in_len - 1] == '=') out_len--;
|
||||||
if (input[in_len - 2] == '=') out_len--;
|
if (input[in_len - 2] == '=') out_len--;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue