[thin_dump] Fix warnings on potential NULL pointer

This commit is contained in:
Ming-Hung Tsai
2021-06-02 13:08:47 +08:00
parent 2e62363446
commit 25ed2dfc9a
3 changed files with 10 additions and 16 deletions

View File

@@ -25,8 +25,14 @@ command::die(string const &msg)
}
::uint64_t
command::parse_uint64(string const &str, string const &desc)
command::parse_uint64(char const *str, char const *desc)
{
if (!str) {
ostringstream out;
out << "Couldn't parse " << desc << ": NULL";
die(out.str());
}
try {
// FIXME: check trailing garbage is handled
return lexical_cast<::uint64_t>(str);