# gpui: Avoid dereferencing null pointer in \`MacWindow::active_window\` \(\#28059\) · gitcafe/zed

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

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

Visibility: public

Requested revision: ec40e2d85c085677138a69ee63d82067f4dda67e

Requested commit: ec40e2d85c085677138a69ee63d82067f4dda67e

Commit: ec40e2d85c085677138a69ee63d82067f4dda67e

Tree: 1ab6ab289408a6fa38c14de126506d7a816a02a6

Author: Marshall Bowers

Committer: GitHub

## Message

```
gpui: Avoid dereferencing null pointer in `MacWindow::active_window` (#28059)

This PR adds a check to avoid dereferencing a null pointer in
`MacWindow::active_window`.

Rust 1.86 now has a [debug assertion for dereferencing null
pointers](https://blog.rust-lang.org/2025/04/03/Rust-1.86.0.html#debug-assertions-that-pointers-are-non-null-when-required-for-soundness),
which means that losing focus of the window would cause a null pointer
to be dereferenced and panic.

Release Notes:

- N/A
```

## Parents

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

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