render: NULL protect cpAlphaMap()

Even though it practically should never happen, but just in case, and
for silencing the analyzer, add an extra check here (which doesn't
cost us much).

| ../render/picture.c: In function ‘cpAlphaMap’:
| ../render/picture.c:1002:30: warning: dereference of NULL ‘screen’ [CWE-476] [-Wanalyzer-null-dereference]
|  1002 |         id = res->info[screen->myNum].id;
|       |                        ~~~~~~^~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-05-06 16:47:01 +02:00
parent 8a71c7338c
commit 67751f6096

View File

@ -1013,7 +1013,10 @@ cpAlphaMap(void **result, XID id, ScreenPtr screen, ClientPtr client, Mask mode)
client, mode);
if (err != Success)
return err;
id = res->info[screen->myNum].id;
if (screen == NULL)
LogMessage(X_WARNING, "cpAlphaMap() screen == NULL\n");
else
id = res->info[screen->myNum].id;
}
#endif /* XINERAMA */
return dixLookupResourceByType(result, id, PictureType, client, mode);