Commit 7d3371f1 authored by Aleksei Nikiforov's avatar Aleksei Nikiforov Committed by Nate Graham
Browse files

[applets/taskmanager] Fix "virtualDesktops is undefined" error

It looks like virtualDesktops may be undefined under some circumstances
if only 1 desktop is used. Explicitly check that it's not undefined,
and process virtual desktops information only when it's used.
parent 2b783eb7
......@@ -390,16 +390,17 @@ ColumnLayout {
var subTextEntries = [];
var virtualDesktops = isGroup ? VirtualDesktops : virtualDesktopParent;
var virtualDesktopNameList = new Array();
for (var i = 0; i < virtualDesktops.length; ++i) {
virtualDesktopNameList.push(virtualDesktopInfo.desktopNames[virtualDesktopInfo.desktopIds.indexOf(virtualDesktops[i])]);
}
var onAllDesktops = (isGroup ? IsOnAllVirtualDesktops : isOnAllVirtualDesktopsParent) === true;
if (!plasmoid.configuration.showOnlyCurrentDesktop && virtualDesktopInfo.numberOfDesktops > 1) {
if (!onAllDesktops && virtualDesktops.length > 0) {
var virtualDesktops = isGroup ? VirtualDesktops : virtualDesktopParent;
if (!onAllDesktops && virtualDesktops !== undefined && virtualDesktops.length > 0) {
var virtualDesktopNameList = new Array();
for (var i = 0; i < virtualDesktops.length; ++i) {
virtualDesktopNameList.push(virtualDesktopInfo.desktopNames[virtualDesktopInfo.desktopIds.indexOf(virtualDesktops[i])]);
}
subTextEntries.push(i18nc("Comma-separated list of desktops", "On %1",
virtualDesktopNameList.join(", ")));
} else if (onAllDesktops) {
......
Supports Markdown
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