Catch exceptions from content_factory().
authorCarl Hetherington <cth@carlh.net>
Sun, 28 Feb 2016 18:16:45 +0000 (18:16 +0000)
committerCarl Hetherington <cth@carlh.net>
Sun, 28 Feb 2016 18:16:45 +0000 (18:16 +0000)
src/wx/content_panel.cc

index cefb5b0d90dc795f1bc9a09362490baf031033f3..efc445bc905f36da2db2a597d7a0601176cdacd4 100644 (file)
@@ -46,6 +46,7 @@ using std::list;
 using std::string;
 using std::cout;
 using std::vector;
+using std::exception;
 using boost::shared_ptr;
 using boost::weak_ptr;
 using boost::dynamic_pointer_cast;
@@ -311,7 +312,15 @@ ContentPanel::add_folder_clicked ()
                return;
        }
 
-       shared_ptr<Content> content = content_factory (_film, path);
+       shared_ptr<Content> content;
+
+       try {
+               content = content_factory (_film, path);
+       } catch (exception& e) {
+               error_dialog (_parent, e.what());
+               return;
+       }
+
        if (!content) {
                error_dialog (_parent, _("No content found in this folder."));
                return;