summaryrefslogtreecommitdiff
path: root/absl/flags/parse.cc
diff options
context:
space:
mode:
Diffstat (limited to 'absl/flags/parse.cc')
-rw-r--r--absl/flags/parse.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/absl/flags/parse.cc b/absl/flags/parse.cc
index 5a56a356..2f07725f 100644
--- a/absl/flags/parse.cc
+++ b/absl/flags/parse.cc
@@ -525,7 +525,7 @@ std::tuple<bool, absl::string_view> DeduceFlagValue(const CommandLineFlag& flag,
// --my_string_var --foo=bar
// We look for a flag of std::string type, whose value begins with a
// dash and corresponds to known flag or standalone --.
- if (value[0] == '-' && flag.IsOfType<std::string>()) {
+ if (!value.empty() && value[0] == '-' && flag.IsOfType<std::string>()) {
auto maybe_flag_name = std::get<0>(SplitNameAndValue(value.substr(1)));
if (maybe_flag_name.empty() ||