homescreenhandler: Avoid passing an invalid appid 17/27217/2 12.93.0 marlin/12.93.0 marlin_12.93.0
authorMarius Vlad <marius.vlad@collabora.com>
Mon, 21 Feb 2022 18:31:39 +0000 (20:31 +0200)
committerMarius Vlad <marius.vlad@collabora.com>
Tue, 22 Feb 2022 11:27:30 +0000 (13:27 +0200)
If there's no item added in the QList we'll return an invalid value
pointing to some invalid memory, which we can not determine if its empty
string or not, so this makes sure we check the list itself.

Found when looking at removal/activation of surfaces while re-doing some
parts in the compositor.

Bug-AGL: SPEC-4263

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I912aa5a42a7d21374a389a7f193979f30504a83b

homescreen/src/homescreenhandler.cpp

index 5ed1fab..c44cbb9 100644 (file)
@@ -126,6 +126,7 @@ void HomescreenHandler::appTerminated(const QString& application_id)
     HMI_DEBUG("HomeScreen", "Application %s terminated, activating last app", application_id.toStdString().c_str());
     if (apps_stack.contains(application_id)) {
         apps_stack.removeOne(application_id);
-        appStarted(apps_stack.last());
+        if (!apps_stack.isEmpty())
+            appStarted(apps_stack.last());
     }
 }