# Don't panic if worktree was dropped before sending path changes · gitcafe/zed

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

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

Visibility: public

Requested revision: 372e31d54f5e940d741fba4750f14444dcc636f6

Requested commit: 372e31d54f5e940d741fba4750f14444dcc636f6

Commit: 372e31d54f5e940d741fba4750f14444dcc636f6

Tree: cd681d660c1448371db634417da443325cd62c90

Author: Antonio Scandurra

Committer: Antonio Scandurra

## Message

```
Don't panic if worktree was dropped before sending path changes

In `refresh_entry`, we send a message to the `self.path_changes_tx` channel
to notify the background thread that a path has changed. However, given that
`refresh_entry` uses `spawn_weak`, the worktree could get dropped before sending
the message, which could cause a panic.

This commit changes the code to return an error instead of panicking.

```

## Parents

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

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