Fix panic when scrolling in project diff (#25771)

It may happen that the column for the scroll anchor is nonzero, and the
adjustment we're doing here could result in an invalid point in that
case.

Release Notes:

- N/A

Co-authored-by: Max <max@zed.dev>
This commit is contained in:
Cole Miller 2025-02-27 14:35:03 -05:00 committed by GitHub
parent 541a5c01a4
commit eb4fad52df
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -281,6 +281,7 @@ impl ProjectDiff {
let snapshot = multibuffer.snapshot(cx);
let mut point = anchor.to_point(&snapshot);
point.row = (point.row + 1).min(snapshot.max_row().0);
point.column = 0;
let Some((_, buffer, _)) = self.multibuffer.read(cx).excerpt_containing(point, cx)
else {