Skip to content

Commit 3466bac

Browse files
committed
Fix possible nullptr access and remove unused satisfiedOptions
1 parent f87b2d1 commit 3466bac

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

include/BazPO.hpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -325,15 +325,6 @@ namespace BazPO
325325
addOptions(option1, option2, rest...);
326326
}
327327

328-
virtual std::deque<Option*> satisfiedOptions()
329-
{
330-
std::deque<Option*> ret;
331-
for (auto& pair : relativeOptions)
332-
if (pair.second)
333-
ret.emplace_back(pair.first);
334-
return ret;
335-
}
336-
337328
virtual bool satisfied(Option& foundOption) = 0;
338329
virtual std::string what() = 0;
339330

@@ -756,7 +747,7 @@ namespace BazPO
756747
if (option->second.ExistsCount == option->second.MaxValueCount)
757748
++taglessId;
758749
}
759-
else if (m_exitOnUnexpectedValue && (taglessId > getCurrentId() || lastOption->MaxValueCount < lastOption->Values.size()))
750+
else if (m_exitOnUnexpectedValue && (taglessId > getCurrentId() || (lastOption!= nullptr && (lastOption->MaxValueCount < lastOption->Values.size()))))
760751
unknownArgParsingError(m_argv[i]);
761752
}
762753
}

0 commit comments

Comments
 (0)