summaryrefslogtreecommitdiff
path: root/gtk2_ardour/sfdb_ui.cc
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2014-12-30 22:05:10 -0500
committerDavid Robillard <d@drobilla.net>2014-12-30 23:10:11 -0500
commit4facff3b8ea68cf8f90e63e9f41b27349b1a43d6 (patch)
tree82438c34e21360edaa337634c6d68f72ef98a222 /gtk2_ardour/sfdb_ui.cc
parentf499f4cfd2e98ee67d8267aea76a71bf8f47af68 (diff)
Gracefully handle MIDI parse failure.
Diffstat (limited to 'gtk2_ardour/sfdb_ui.cc')
-rw-r--r--gtk2_ardour/sfdb_ui.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/gtk2_ardour/sfdb_ui.cc b/gtk2_ardour/sfdb_ui.cc
index 9ef39d0aaa..8e89ccf4b3 100644
--- a/gtk2_ardour/sfdb_ui.cc
+++ b/gtk2_ardour/sfdb_ui.cc
@@ -283,10 +283,15 @@ SoundFileBox::setup_labels (const string& filename)
if (SMFSource::valid_midi_file (path)) {
- boost::shared_ptr<SMFSource> ms =
- boost::dynamic_pointer_cast<SMFSource> (
- SourceFactory::createExternal (DataType::MIDI, *_session,
- path, 0, Source::Flag (0), false));
+ boost::shared_ptr<SMFSource> ms;
+ try {
+ ms = boost::dynamic_pointer_cast<SMFSource> (
+ SourceFactory::createExternal (DataType::MIDI, *_session,
+ path, 0, Source::Flag (0), false));
+ } catch (const std::exception& e) {
+ error << string_compose(_("Could not read file: %1 (%2)."),
+ path, e.what()) << endmsg;
+ }
preview_label.set_markup (_("<b>Midi File Information</b>"));