Commit 5cb38dae authored by David Edmundson's avatar David Edmundson Committed by Nate Graham
Browse files

[containmentactions] Guard against having no virtual desktops

It can apparently happen that virtual desktops is empty at a given point
in time. Potentially due to other bugs on the system.

Calls to desktopIds.at(N) will fail.

BUG: 427106


(cherry picked from commit 2441c82a)
parent 3acf8f30
......@@ -85,6 +85,10 @@ void SwitchDesktop::switchTo()
void SwitchDesktop::performNextAction()
{
const QVariantList &desktopIds = m_virtualDesktopInfo->desktopIds();
if (desktopIds.isEmpty()) {
return;
}
const QVariant &currentDesktop = m_virtualDesktopInfo->currentDesktop();
const int currentDesktopIndex = desktopIds.indexOf(currentDesktop);
......@@ -100,6 +104,9 @@ void SwitchDesktop::performNextAction()
void SwitchDesktop::performPreviousAction()
{
const QVariantList &desktopIds = m_virtualDesktopInfo->desktopIds();
if (desktopIds.isEmpty()) {
return;
}
const QVariant &currentDesktop = m_virtualDesktopInfo->currentDesktop();
const int currentDesktopIndex = desktopIds.indexOf(currentDesktop);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment