Merge lp:~attente/content-hub/1655105 into lp:content-hub

Proposed by William Hua
Status: Merged
Approved by: Ken VanDine
Approved revision: 314
Merged at revision: 325
Proposed branch: lp:~attente/content-hub/1655105
Merge into: lp:content-hub
Diff against target: 26 lines (+10/-6)
1 file modified
src/com/ubuntu/content/utils.cpp (+10/-6)
To merge this branch: bzr merge lp:~attente/content-hub/1655105
Reviewer Review Type Date Requested Status
Ken VanDine Approve
Review via email: mp+314356@code.launchpad.net

Commit message

Prevent crash when creating a paste with a bogus app id

Description of the change

Prevent crash when creating a paste with a bogus app id

To post a comment you must log in.
Revision history for this message
Ken VanDine (ken-vandine) wrote :

Great, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/com/ubuntu/content/utils.cpp'
2--- src/com/ubuntu/content/utils.cpp 2016-11-07 14:59:44 +0000
3+++ src/com/ubuntu/content/utils.cpp 2017-01-09 18:15:55 +0000
4@@ -212,12 +212,16 @@
5 auto app_id = ual::AppID::find(id.toStdString());
6 if (app_id.empty())
7 return false;
8- auto app = ual::Application::create(app_id, reg);
9- if (!app.get()->hasInstances())
10- return false;
11- Q_FOREACH (std::shared_ptr<ual::Application::Instance> instance, app.get()->instances()) {
12- if (instance.get()->hasPid(pid))
13- return true;
14+ try {
15+ auto app = ual::Application::create(app_id, reg);
16+ if (!app.get()->hasInstances())
17+ return false;
18+ Q_FOREACH (std::shared_ptr<ual::Application::Instance> instance, app.get()->instances()) {
19+ if (instance.get()->hasPid(pid))
20+ return true;
21+ }
22+ } catch (...) {
23+ qWarning() << Q_FUNC_INFO << "Failed to create Application for" << id;
24 }
25 return false;
26 }

Subscribers

People subscribed via source and target branches