Guard against an empty string

This commit is contained in:
Ronald Wampler
2018-10-29 15:00:56 -04:00
committed by Allan Odgaard
parent bad84bd511
commit 18c8d1685c

View File

@@ -2,7 +2,7 @@
static bool is_numeric (std::string const& str)
{
return str.find_first_not_of("0123456789") == std::string::npos;
return !str.empty() && str.find_first_not_of("0123456789") == std::string::npos;
}
static std::vector<std::string> components (std::string const& str)