x11-wm/sway: backport a crashfix from 1.8
Inspired by: Arch Linux
(direct commit to 2022Q4 as b22b6eeffd22 is missing on the branch)