on xenial help sign in
Don't crash when we get an invalid app from ApplicationManager Fixes: 1309162
117f17eMichael Zanetti
plugins/Unity/Launcher/launchermodel.cpp+6
@@ -23,6 +23,8 @@
23
23
24#include <unity/shell/application/ApplicationInfoInterface.h>
24#include <unity/shell/application/ApplicationInfoInterface.h>
25
25
26+#include <QDebug>
27+
26using namespace unity::shell::application;
28using namespace unity::shell::application;
27
29
28LauncherModel::LauncherModel(QObject *parent):
30LauncherModel::LauncherModel(QObject *parent):
@@ -337,6 +339,10 @@ void LauncherModel::applicationAdded(const QModelIndex &parent, int row)
337 Q_UNUSED(parent);
339 Q_UNUSED(parent);
338
340
339 ApplicationInfoInterface *app = m_appManager->get(row);
341 ApplicationInfoInterface *app = m_appManager->get(row);
342+ if (!app) {
343+ qWarning() << "LauncherModel received an applicationAdded signal, but there's no such application!";
344+ return;
345+ }
340
346
341 bool found = false;
347 bool found = false;
342 Q_FOREACH(LauncherItem *item, m_list) {
348 Q_FOREACH(LauncherItem *item, m_list) {