core: check if a chosen backend is available
Error out instead of segfaulting when the chosen backend is not available. Fixes #210 Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
1f80c8dc16
commit
ddde118c69
|
@ -258,8 +258,8 @@ static bool run_fade(session_t *ps, struct managed_win **_w, long steps) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note even if opacity == opacity_target here, we still want to run preprocess one
|
// Note even if opacity == opacity_target here, we still want to run preprocess
|
||||||
// last time to finish state transition. So return true in that case too.
|
// one last time to finish state transition. So return true in that case too.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -723,7 +723,13 @@ static bool initialize_backend(session_t *ps) {
|
||||||
if (ps->o.experimental_backends) {
|
if (ps->o.experimental_backends) {
|
||||||
assert(!ps->backend_data);
|
assert(!ps->backend_data);
|
||||||
// Reinitialize win_data
|
// Reinitialize win_data
|
||||||
|
if (backend_list[ps->o.backend]) {
|
||||||
ps->backend_data = backend_list[ps->o.backend]->init(ps);
|
ps->backend_data = backend_list[ps->o.backend]->init(ps);
|
||||||
|
} else {
|
||||||
|
log_error("Backend \"%s\" is not available as part of the "
|
||||||
|
"experimental backends.",
|
||||||
|
BACKEND_STRS[ps->o.backend]);
|
||||||
|
}
|
||||||
if (!ps->backend_data) {
|
if (!ps->backend_data) {
|
||||||
log_fatal("Failed to initialize backend, aborting...");
|
log_fatal("Failed to initialize backend, aborting...");
|
||||||
quit_compton(ps);
|
quit_compton(ps);
|
||||||
|
|
Loading…
Reference in New Issue