diff options
author | Jack Lloyd <[email protected]> | 2019-07-05 18:43:48 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2019-07-05 18:43:48 -0400 |
commit | b4c0ea7eb4f21a07953cc0865465eac82bd11e69 (patch) | |
tree | f6b2ab44ede4b7aab40844e90604478cb6d7973b /src/lib | |
parent | e7d15e07f8cbe0998fbc318413d5367398195b12 (diff) | |
parent | a9e4eb9ce808ba5d0b6ab69ef7cfc2d15050713d (diff) |
Merge GH #2023 Avoid needless allocation in OctetString default constructor
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/base/symkey.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/lib/base/symkey.cpp b/src/lib/base/symkey.cpp index 115c3ea67..4b853d995 100644 --- a/src/lib/base/symkey.cpp +++ b/src/lib/base/symkey.cpp @@ -26,8 +26,11 @@ OctetString::OctetString(RandomNumberGenerator& rng, */ OctetString::OctetString(const std::string& hex_string) { - m_data.resize(1 + hex_string.length() / 2); - m_data.resize(hex_decode(m_data.data(), hex_string)); + if(!hex_string.empty()) + { + m_data.resize(1 + hex_string.length() / 2); + m_data.resize(hex_decode(m_data.data(), hex_string)); + } } /* |