diff options
author | Jack Lloyd <[email protected]> | 2019-05-01 08:06:30 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2019-05-01 08:06:30 -0400 |
commit | 1b7a28f725457806e88e8322db737d02b4dc7437 (patch) | |
tree | 519948f3ac9ddc70363ecdfc114f87b77e13e52b /src/lib/base | |
parent | 1aeddd8b47ead54d938ee05bb358ba974529502f (diff) |
Improve error message
Re GH #1912
Diffstat (limited to 'src/lib/base')
-rw-r--r-- | src/lib/base/scan_name.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lib/base/scan_name.cpp b/src/lib/base/scan_name.cpp index 8a20caddb..954db7c45 100644 --- a/src/lib/base/scan_name.cpp +++ b/src/lib/base/scan_name.cpp @@ -13,8 +13,7 @@ namespace Botan { namespace { -std::string make_arg( - const std::vector<std::pair<size_t, std::string> >& name, size_t start) +std::string make_arg(const std::vector<std::pair<size_t, std::string>>& name, size_t start) { std::string output = name[start].second; size_t level = name[start].first; @@ -60,7 +59,10 @@ SCAN_Name::SCAN_Name(const char* algo_spec) : SCAN_Name(std::string(algo_spec)) SCAN_Name::SCAN_Name(std::string algo_spec) : m_orig_algo_spec(algo_spec), m_alg_name(), m_args(), m_mode_info() { - std::vector<std::pair<size_t, std::string> > name; + if(algo_spec.size() == 0) + throw Invalid_Argument("Expected algorithm name, got empty string"); + + std::vector<std::pair<size_t, std::string>> name; size_t level = 0; std::pair<size_t, std::string> accum = std::make_pair(level, ""); |