commit f9029ba4f64083bfbdb582c6798df92972ea5b90
parent 1c43e3315699bb6d295c9c927d62c761a38ba00b
Author: sam-barr <samfbarr@outlook.com>
Date: Wed, 22 Apr 2020 00:50:58 -0500
Error handling for XOpenDisplay()
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/paleofetch.c b/paleofetch.c
@@ -160,6 +160,10 @@ char *get_shell() {
char *get_resolution() {
Display *display = XOpenDisplay(NULL);
+ if(display == NULL) {
+ status = -1;
+ halt_and_catch_fire("XOpenDisplay failed");
+ }
int screen = DefaultScreen(display);
int width = DisplayWidth(display, screen);