Skip to content
This repository was archived by the owner on Feb 28, 2025. It is now read-only.

Commit 9f020f7

Browse files
committed
Merge branch '4651_mouse_drag_segfault'
* 4651_mouse_drag_segfault: (panel_mouse_is_on_item): fix return value Ticket #4651: segfault when dragging mouse in half-empty panel.
2 parents ee8b381 + 130d0f0 commit 9f020f7

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/filemanager/panel.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2061,8 +2061,14 @@ move_down (WPanel *panel)
20612061
{
20622062
int items;
20632063

2064-
if (panel->dir.len == 0 || panel->current + 1 == panel->dir.len)
2064+
if (panel->dir.len == 0)
2065+
return;
2066+
2067+
if (panel->current >= panel->dir.len - 1)
2068+
{
2069+
panel->current = panel->dir.len - 1;
20652070
return;
2071+
}
20662072

20672073
unselect_item (panel);
20682074
panel->current++;
@@ -3944,7 +3950,7 @@ panel_mouse_is_on_item (const WPanel *panel, int y, int x)
39443950
y += panel->top + lines * col;
39453951

39463952
// are we below or in the next column of last file?
3947-
if (y > panel->dir.len)
3953+
if (y >= panel->dir.len)
39483954
return MOUSE_AFTER_LAST_FILE;
39493955

39503956
// we are on item of the file file; return an index to select a file

0 commit comments

Comments
 (0)