Util: Fix nullptr derefencing
In order to compare strings, the STL has to dereference the data pointer. So check if its not a nullptr first.
This commit is contained in:
@@ -141,7 +141,7 @@ bool ArgParser::parseLongOption(std::string_view option, std::string_view next)
|
|||||||
printf("Parsing long option: '%s' with value '%s'\n", name.data(), argumentProvided ? value.data() : "");
|
printf("Parsing long option: '%s' with value '%s'\n", name.data(), argumentProvided ? value.data() : "");
|
||||||
|
|
||||||
auto foundOption = std::find_if(m_options.begin(), m_options.end(), [&name](Option& it) -> bool {
|
auto foundOption = std::find_if(m_options.begin(), m_options.end(), [&name](Option& it) -> bool {
|
||||||
return it.longName == name;
|
return it.longName && it.longName == name;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (foundOption == m_options.cend()) {
|
if (foundOption == m_options.cend()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user