x: handle NULL pointer in x_strerror

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2020-04-05 21:45:51 +01:00
parent b652e8b58d
commit fb24e33d52
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
1 changed files with 3 additions and 0 deletions

View File

@ -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, * for multiple calls to this function,
*/ */
const char *x_strerror(xcb_generic_error_t *e) { 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); return _x_strerror(e->full_sequence, e->major_code, e->minor_code, e->error_code);
} }