ukui-notification-daemon/0002-fix-ukui-notification-daemon-SIGSEGV.patch
peijiankang 1171775037 fix ukui-notification-daemon SIGSEGV
(cherry picked from commit a9cb344872bd6428f3a6ff5120fc002aec0f9ecd)
2023-07-27 11:15:43 +08:00

29 lines
681 B
Diff

From 0e06e1110a0ea4fcff9ff3380ad657d80db95305 Mon Sep 17 00:00:00 2001
From: peijiankang <peijiankang@kylinos.cn>
Date: Fri, 21 Jul 2023 17:19:50 +0800
Subject: [PATCH] fix ukui-notification-daemon SIGSEGV
---
src/main.cpp | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/main.cpp b/src/main.cpp
index 0309f7b..0bc1028 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -36,6 +36,11 @@
int getScreenWidth() {
Display *disp = XOpenDisplay(NULL);
+ if (disp == NULL) {
+ fprintf(stderr, "Cannot connect to X server\n");
+ return 0;
+ }
+
Screen *scrn = DefaultScreenOfDisplay(disp);
if (NULL == scrn) {
return 0;
--
2.33.0