From 4264361469fc54b85cc46dee0aa8e01a3f3272ab Mon Sep 17 00:00:00 2001 From: Shaolin Date: Wed, 29 Aug 2018 00:51:45 -0300 Subject: [PATCH] UI: Fix a rare multiview crash when clicked This was triggered by openning a fullscreen projector and trying to alt tab. The projector was still on top but the first click on a KDE system was returning a NULL activeWindow. --- UI/window-projector.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/UI/window-projector.cpp b/UI/window-projector.cpp index 7c89ff979..ee9ab5044 100644 --- a/UI/window-projector.cpp +++ b/UI/window-projector.cpp @@ -695,14 +695,16 @@ void OBSProjector::OBSSourceRemoved(void *data, calldata_t *params) static int getSourceByPosition(int x, int y, float ratio) { - QWidget *rec = QApplication::activeWindow(); + int pos = -1; + QWidget *rec = QApplication::activeWindow(); + if (!rec) + return pos; int cx = rec->width(); int cy = rec->height(); int minX = 0; int minY = 0; int maxX = cx; int maxY = cy; - int pos = -1; switch (multiviewLayout) { case MultiviewLayout::HORIZONTAL_TOP_24_SCENES: