summaryrefslogtreecommitdiff
path: root/src/protocols/GammaControl.cpp
diff options
context:
space:
mode:
authorVaxry <vaxry@vaxry.net>2024-10-09 22:00:06 +0100
committerVaxry <vaxry@vaxry.net>2024-10-09 22:00:06 +0100
commitc4eb1940336cd88ca65ba65582ce104e49dfc7c9 (patch)
tree29a39f1b3790232776180a26802ae67342029f7e /src/protocols/GammaControl.cpp
parent6ae89940c761d4ed4317df0af29e8df41d472091 (diff)
gammactrl: guard pMonitor in setGamma
Diffstat (limited to 'src/protocols/GammaControl.cpp')
-rw-r--r--src/protocols/GammaControl.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/protocols/GammaControl.cpp b/src/protocols/GammaControl.cpp
index 077d6e2f..e794e543 100644
--- a/src/protocols/GammaControl.cpp
+++ b/src/protocols/GammaControl.cpp
@@ -46,6 +46,13 @@ CGammaControl::CGammaControl(SP<CZwlrGammaControlV1> resource_, wl_resource* out
resource->setOnDestroy([this](CZwlrGammaControlV1* gamma) { PROTO::gamma->destroyGammaControl(this); });
resource->setSetGamma([this](CZwlrGammaControlV1* gamma, int32_t fd) {
+ if (!pMonitor) {
+ LOGM(ERR, "setGamma for a dead monitor");
+ resource->sendFailed();
+ close(fd);
+ return;
+ }
+
LOGM(LOG, "setGamma for {}", pMonitor->szName);
int fdFlags = fcntl(fd, F_GETFL, 0);