shithub: fm

Download patch

ref: fa802d92078fa974f5ac10e756e9cd3cbb55b5dc
parent: 7633a56ff04b4d8ec683b34224c41304e422ca28
author: phil9 <[email protected]>
date: Sun Aug 13 01:32:15 EDT 2023

ensure selection has a valid index before redrawing it

	if there was no selection because nothing matched the input list and then the match list
	is repopulated, moving the selection using the arrow keys would lead to fm crashing because
	we were trying to redraw an invalid selection index (-1).

--- a/main.c
+++ b/main.c
@@ -253,7 +253,8 @@
 void
 changesel(int from, int to)
 {
-	drawline(from, 0);
+	if(from >= 0)
+		drawline(from, 0);
 	drawline(to, 1);
 	flushimage(display, 1);
 }