From fb24e33d5200d696472a6fcdf5d0fea0e12be652 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Sun, 5 Apr 2020 21:45:51 +0100 Subject: [PATCH] x: handle NULL pointer in x_strerror Signed-off-by: Yuxuan Shui --- src/x.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/x.c b/src/x.c index 1b359fa..0d97ff5 100644 --- a/src/x.c +++ b/src/x.c @@ -434,6 +434,9 @@ void x_print_error(unsigned long serial, uint8_t major, uint16_t minor, uint8_t * for multiple calls to this function, */ const char *x_strerror(xcb_generic_error_t *e) { + if (!e) { + return "No error"; + } return _x_strerror(e->full_sequence, e->major_code, e->minor_code, e->error_code); }