Fix crash when adding cinemas while a search is in force (#2378).
authorCarl Hetherington <cth@carlh.net>
Wed, 23 Nov 2022 20:20:14 +0000 (21:20 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 23 Nov 2022 20:23:25 +0000 (21:23 +0100)
src/wx/screens_panel.cc

index b7defe0e9be39e482d6163fe1f4f1972edb21330..1d94d1acb9f8027a571403d1811698bdbb73f2ac 100644 (file)
@@ -249,7 +249,12 @@ ScreensPanel::add_cinema_clicked ()
 
                wxTreeListItem previous = wxTLI_FIRST;
                bool found = false;
+               auto search = wx_to_std(_search->GetValue());
+               convert_to_lower(search);
                for (auto existing_cinema: cinemas) {
+                       if (!matches_search(existing_cinema, search)) {
+                               continue;
+                       }
                        if (_collator.compare(dialog->name(), existing_cinema->name) < 0) {
                                /* existing_cinema should be after the one we're inserting */
                                found = true;