From 497e54c026f87ef020477bfe7c0249802373c630 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Wed, 1 Sep 2021 03:12:09 +0300 Subject: [PATCH] Fix incorrect iterator manipulation Now that opts is a vector, erase invalidates iterators. --- source/core/getopt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/core/getopt.cpp b/source/core/getopt.cpp index 6f7b1f8..13e235f 100644 --- a/source/core/getopt.cpp +++ b/source/core/getopt.cpp @@ -32,7 +32,7 @@ GetOpt::OptionImpl &GetOpt::add_option(char s, const string &l, const Store &t, if((s!=0 && (*i)->get_short()==s) || (*i)->get_long()==l) { delete *i; - opts.erase(i++); + i = opts.erase(i); } else ++i; -- 2.43.0