iconGrid: Bail out when not on a monitor

There shouldn't be any code that calls zoomOutActor() without
a monitor, but throwing in an early return doesn't hurt.

CID 351285.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1950>
This commit is contained in:
Florian Müllner 2021-08-13 03:21:47 +02:00
parent 46b0d3f6cc
commit 4b4d422c1e

View File

@ -193,6 +193,10 @@ function zoomOutActor(actor) {
}
function zoomOutActorAtPos(actor, x, y) {
const monitor = Main.layoutManager.findMonitorForActor(actor);
if (!monitor)
return;
const actorClone = new Clutter.Clone({
source: actor,
reactive: false,
@ -207,7 +211,6 @@ function zoomOutActorAtPos(actor, x, y) {
Main.uiGroup.add_actor(actorClone);
// Avoid monitor edges to not zoom outside the current monitor
let monitor = Main.layoutManager.findMonitorForActor(actor);
let scaledWidth = width * APPICON_ANIMATION_OUT_SCALE;
let scaledHeight = height * APPICON_ANIMATION_OUT_SCALE;
let scaledX = x - (scaledWidth - width) / 2;