# gpui: Fix out-of-bounds panic rendering GIFs \(\#54701\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 749fcfdfd860362b8538a66a88419d318a9b0c9c

Requested commit: 749fcfdfd860362b8538a66a88419d318a9b0c9c

Commit: 749fcfdfd860362b8538a66a88419d318a9b0c9c

Tree: 9e6bfa8540a4f164b0f542eb505973f040a05ed9

Author: Smit Barmase

Committer: GitHub

## Message

```
gpui: Fix out-of-bounds panic rendering GIFs (#54701)

Clamp the cached `frame_index` of an `img` element when the underlying
image changes so a stale index from a previous, longer animation cannot
index out of bounds on the new image.

Release Notes:

- Fixed a panic when a GIF was replaced with one that had fewer frames
in Markdown Preview.
```

## Parents

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

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