Fix crash with a non-existent playlist directory.
authorCarl Hetherington <cth@carlh.net>
Sat, 23 Dec 2023 09:57:49 +0000 (10:57 +0100)
committerCarl Hetherington <cth@carlh.net>
Sat, 23 Dec 2023 09:57:49 +0000 (10:57 +0100)
src/tools/dcpomatic_playlist.cc

index e4ad3c6585cf3776dd3e10732537ab630b112640..8c7c38038df7ad318379edf9a94da197d5df834a 100644 (file)
@@ -223,13 +223,15 @@ private:
 
                _list->DeleteAllItems ();
                _playlists.clear ();
-               for (auto i: dcp::filesystem::directory_iterator(*path)) {
-                       auto spl = make_shared<SignalSPL>();
-                       try {
-                               spl->read (i, _content_store);
-                               add_playlist_to_model (spl);
-                       } catch (...) {}
-               }
+               try {
+                       for (auto i: dcp::filesystem::directory_iterator(*path)) {
+                               auto spl = make_shared<SignalSPL>();
+                               try {
+                                       spl->read (i, _content_store);
+                                       add_playlist_to_model (spl);
+                               } catch (...) {}
+                       }
+               } catch (...) {}
 
                for (auto i: _playlists) {
                        add_playlist_to_view (i);