From 6cc4eac00e5985e41f20c3cbd184e5f4731d2f7d Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Wed, 9 Sep 2009 17:05:36 +0200 Subject: [PATCH] fix iteration through list from previous commit if last item was removed, 'it' would be set to Patterns.end() and then for loop was incrementing 'it', bypassing conditional for exit by that. --- src/tag_editor.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/tag_editor.cpp b/src/tag_editor.cpp index b0ac1006..2df6a203 100644 --- a/src/tag_editor.cpp +++ b/src/tag_editor.cpp @@ -458,9 +458,13 @@ void TagEditor::EnterPressed() } else if (success) { - for (std::list::iterator it = Patterns.begin(); it != Patterns.end(); ++it) + for (std::list::iterator it = Patterns.begin(); ; ++it) + { if (*it == Config.pattern) it = Patterns.erase(it); + if (it == Patterns.end()) + break; + } Patterns.insert(Patterns.begin(), Config.pattern); quit = 1; }