mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:58:12 +00:00
HackStudio: Fix crash when clicking unstaged files
In certain cases, an index might be invalid in the unstaged files view. We must check if this index is valid before attempting to read the index's data.
This commit is contained in:
parent
c0a3b1467c
commit
507ad1954f
1 changed files with 3 additions and 0 deletions
|
@ -45,6 +45,9 @@ GitWidget::GitWidget(const LexicalPath& repo_root)
|
|||
Gfx::Bitmap::try_load_from_file("/res/icons/16x16/plus.png").release_value_but_fixme_should_propagate_errors());
|
||||
m_unstaged_files->on_selection_change = [this] {
|
||||
const auto& index = m_unstaged_files->selection().first();
|
||||
if (!index.is_valid())
|
||||
return;
|
||||
|
||||
const auto& selected = index.data().as_string();
|
||||
show_diff(LexicalPath(selected));
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue