on xenial help sign in
Catch potential exception when registering albumart image provider.
commitc812b151479c469027ccbd48cf45b07076bade4a authorPawel Stolowski <pawel.stolowski@canonical.com> dateWed 9 Oct 2013, 19:07 (13 years ago) parent15f0ee5
1 file changed+12−1
plugins/Utils/plugin.cpp+12−1
plugins/Utils/plugin.cpp+12−1
@@ -52,5 +52,16 @@ void UtilsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
5252{
5353 QQmlExtensionPlugin::initializeEngine(engine, uri);
5454
55− engine->addImageProvider(QLatin1String("albumart"), new AlbumArtProvider);
55+ try
56+ {
57+ engine->addImageProvider(QLatin1String("albumart"), new AlbumArtProvider);
58+ }
59+ catch (const std::runtime_error &e)
60+ {
61+ qWarning() << "Failed to register image provider for albumart:" << e.what();
62+ }
63+ catch (...)
64+ {
65+ qWarning() << "Failed to register image provider for albumart (unknown error)";
66+ }
5667}