fix: guard rename/update_url actions against empty remote list (#2870)

* fix: guard rename/update_url actions against empty remote list

The rename_remote() and update_remote_url() event handlers in
RemoteListPopup did not check valid_selection() before indexing
into self.remote_names, causing a panic (index out of bounds)
when no remotes are configured.

The delete_remote() handler already had this guard. This commit
adds the same valid_selection() check to the other two handlers
for consistency.

Fixes #2868
Fixes #2869

* chore: add changelog entry and sort Cargo.toml dependencies

* revert: restore original Cargo.toml formatting
This commit is contained in:
xvchris 2026-03-20 06:51:09 +08:00 committed by GitHub
parent 09d6726675
commit 06a3f660b2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View file

@ -10,6 +10,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
* rust msrv bumped to `1.88`
### Fixed
* fix panic when renaming or updating remote URL with no remotes configured [[@xvchris](https://github.com/xvchris)] ([#2868](https://github.com/gitui-org/gitui/issues/2868))
## [0.28.0] - 2025-12-14
**discard changes on checkout**

View file

@ -146,12 +146,14 @@ impl Component for RemoteListPopup {
} else if key_match(
e,
self.key_config.keys.update_remote_name,
) {
) && self.valid_selection()
{
self.rename_remote();
} else if key_match(
e,
self.key_config.keys.update_remote_url,
) {
) && self.valid_selection()
{
self.update_remote_url();
}
}