# Fix possibility of infinite loop in selections_with_autoclose_regions \(\#3138\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/199740902ae707ebc50447adcb47e4acfe7d35b4)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 199740902ae707ebc50447adcb47e4acfe7d35b4

Requested commit: 199740902ae707ebc50447adcb47e4acfe7d35b4

Commit: 199740902ae707ebc50447adcb47e4acfe7d35b4

Tree: 992604aaec3c4bbdecdc900d7ff622e7ce633ed0

Author: Max Brunsfeld

Committer: GitHub

## Message

```
Fix possibility of infinite loop in selections_with_autoclose_regions (#3138)

Previously, that method could loop forever if the editor's autoclose
regions had unexpected selection ids.

Something must have changed recently that allowed this invariant to be
violated, but regardless, this code should not have relied on that
invariant to terminate like this.
```

## Parents

- [4e68b588be4bf2107d03749bbf60b0af9ca80da2](https://git.cafe/gitcafe/zed/commit/4e68b588be4bf2107d03749bbf60b0af9ca80da2?format=markdown)

- [655c9ece2decdb550192959175c9cd3cd88f26d1](https://git.cafe/gitcafe/zed/commit/655c9ece2decdb550192959175c9cd3cd88f26d1?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/199740902ae707ebc50447adcb47e4acfe7d35b4?format=markdown)
