From: Mikko Rasa Date: Wed, 1 Sep 2021 00:12:09 +0000 (+0300) Subject: Fix incorrect iterator manipulation X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=497e54c026f87ef020477bfe7c0249802373c630;p=libs%2Fcore.git Fix incorrect iterator manipulation Now that opts is a vector, erase invalidates iterators. --- 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;