aboutsummaryrefslogtreecommitdiffstats
path: root/src/codec/hex/hex.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/codec/hex/hex.cpp')
-rw-r--r--src/codec/hex/hex.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/codec/hex/hex.cpp b/src/codec/hex/hex.cpp
index 49d6e7190..41ba1298d 100644
--- a/src/codec/hex/hex.cpp
+++ b/src/codec/hex/hex.cpp
@@ -37,9 +37,7 @@ void hex_encode(char output[],
std::string hex_encode(const MemoryRegion<byte>& input,
bool uppercase)
{
- return hex_encode(&input[0],
- input.size(),
- uppercase);
+ return hex_encode(&input[0], input.size(), uppercase);
}
std::string hex_encode(const byte input[],
@@ -47,7 +45,10 @@ std::string hex_encode(const byte input[],
bool uppercase)
{
std::string output(2 * input_length, 0);
- hex_encode(&output[0], input, input_length, uppercase);
+
+ if(input_length)
+ hex_encode(&output[0], input, input_length, uppercase);
+
return output;
}