mirror of
https://github.com/swaywm/sway.git
synced 2024-12-30 17:06:40 +01:00
swaylock: Fix crash when unable to connect to wl
Prevent swaylock from crashing when it can't connect to wayland for whatever reason. i.e. XDG_RUNTIME_DIR not set. Fix #534
This commit is contained in:
parent
a99970d7a3
commit
a8f989c651
1 changed files with 7 additions and 1 deletions
|
@ -31,7 +31,9 @@ void sway_terminate(int exit_code) {
|
||||||
window_teardown(window);
|
window_teardown(window);
|
||||||
}
|
}
|
||||||
list_free(surfaces);
|
list_free(surfaces);
|
||||||
|
if (registry) {
|
||||||
registry_teardown(registry);
|
registry_teardown(registry);
|
||||||
|
}
|
||||||
exit(exit_code);
|
exit(exit_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,6 +294,10 @@ int main(int argc, char **argv) {
|
||||||
surfaces = create_list();
|
surfaces = create_list();
|
||||||
registry = registry_poll();
|
registry = registry_poll();
|
||||||
|
|
||||||
|
if (!registry) {
|
||||||
|
sway_abort("Unable to connect to wayland compositor");
|
||||||
|
}
|
||||||
|
|
||||||
if (!registry->swaylock) {
|
if (!registry->swaylock) {
|
||||||
sway_abort("swaylock requires the compositor to support the swaylock extension.");
|
sway_abort("swaylock requires the compositor to support the swaylock extension.");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue