mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-07 08:39:22 +00:00
LibGUI: Fix GTreeView crash on pressing Left/Right without selection
This commit is contained in:
parent
fe421bd7b4
commit
870df4a8c6
Notes:
sideshowbarker
2024-07-19 10:50:15 +09:00
Author: https://github.com/awesomekling
Commit: 870df4a8c6
1 changed files with 2 additions and 2 deletions
|
@ -370,7 +370,7 @@ void GTreeView::keydown_event(GKeyEvent& event)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (event.key() == KeyCode::Key_Left) {
|
if (event.key() == KeyCode::Key_Left) {
|
||||||
if (model()->row_count(cursor_index)) {
|
if (cursor_index.is_valid() && model()->row_count(cursor_index)) {
|
||||||
auto& metadata = ensure_metadata_for_index(cursor_index);
|
auto& metadata = ensure_metadata_for_index(cursor_index);
|
||||||
if (metadata.open) {
|
if (metadata.open) {
|
||||||
metadata.open = false;
|
metadata.open = false;
|
||||||
|
@ -382,7 +382,7 @@ void GTreeView::keydown_event(GKeyEvent& event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (event.key() == KeyCode::Key_Right) {
|
if (event.key() == KeyCode::Key_Right) {
|
||||||
if (model()->row_count(cursor_index)) {
|
if (cursor_index.is_valid() && model()->row_count(cursor_index)) {
|
||||||
auto& metadata = ensure_metadata_for_index(cursor_index);
|
auto& metadata = ensure_metadata_for_index(cursor_index);
|
||||||
if (!metadata.open) {
|
if (!metadata.open) {
|
||||||
metadata.open = true;
|
metadata.open = true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue