mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-02 20:42:11 +02: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:
committed by
Andreas Kling
parent
c0a3b1467c
commit
507ad1954f
Notes:
sideshowbarker
2024-07-17 21:53:03 +09:00
Author: https://github.com/caoimhebyrne Commit: https://github.com/SerenityOS/serenity/commit/507ad1954f6 Pull-request: https://github.com/SerenityOS/serenity/pull/11509 Issue: https://github.com/SerenityOS/serenity/issues/8979 Reviewed-by: https://github.com/itamar8910 ✅
@@ -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));
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user