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 ms = - boost::dynamic_pointer_cast ( - SourceFactory::createExternal (DataType::MIDI, *_session, - path, 0, Source::Flag (0), false)); + boost::shared_ptr ms; + try { + ms = boost::dynamic_pointer_cast ( + 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 (_("Midi File Information"));