core: check experimental_backend before accessing backend_list

backend_list[backend] is only guaranteed to be non-NULL if experimental
backends are used.

Fixes #258

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2019-11-10 05:07:03 +00:00
parent 44a771cf76
commit 30e9e2dc9f
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
1 changed files with 9 additions and 3 deletions

View File

@ -1161,9 +1161,15 @@ xcb_window_t session_get_target_window(session_t *ps) {
} }
static inline uint8_t session_redirection_mode(session_t *ps) { static inline uint8_t session_redirection_mode(session_t *ps) {
if (ps->o.debug_mode || !backend_list[ps->o.backend]->present) { if (ps->o.debug_mode) {
// If the backend is not rendering to the screen, or if the backend // If the backend is not rendering to the screen, we don't need to
// doesn't render anything, we don't need to take over the screen. // take over the screen.
assert(ps->o.experimental_backends);
return XCB_COMPOSITE_REDIRECT_AUTOMATIC;
}
if (ps->o.experimental_backends && !backend_list[ps->o.backend]->present) {
// if the backend doesn't render anything, we don't need to take over the
// screen.
return XCB_COMPOSITE_REDIRECT_AUTOMATIC; return XCB_COMPOSITE_REDIRECT_AUTOMATIC;
} }
return XCB_COMPOSITE_REDIRECT_MANUAL; return XCB_COMPOSITE_REDIRECT_MANUAL;