Merge pull request #2451 from RyanDwyer/fix-ancestor-crash

Fix container_has_ancestor crash
This commit is contained in:
Drew DeVault 2018-08-11 10:28:05 -04:00 committed by GitHub
commit b6428f4751
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -769,7 +769,7 @@ void container_for_each_descendant(struct sway_container *container,
bool container_has_ancestor(struct sway_container *descendant,
struct sway_container *ancestor) {
while (descendant->type != C_ROOT) {
while (descendant && descendant->type != C_ROOT) {
descendant = descendant->parent;
if (descendant == ancestor) {
return true;