[Scummvm-git-logs] scummvm master -> a2e7c9104928d594ff36e54ca16cde9b1ac8bff5

sev- noreply at scummvm.org
Fri Mar 20 12:28:54 UTC 2026


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .

Summary:
a2e7c91049 GUI: Properly process setSelected(-1)


Commit: a2e7c9104928d594ff36e54ca16cde9b1ac8bff5
    https://github.com/scummvm/scummvm/commit/a2e7c9104928d594ff36e54ca16cde9b1ac8bff5
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-03-20T13:28:20+01:00

Commit Message:
GUI: Properly process setSelected(-1)

We should invalidate selection and not just crash.

Used by file browser dialog

Fixes #16600

Changed paths:
    gui/widgets/list.cpp


diff --git a/gui/widgets/list.cpp b/gui/widgets/list.cpp
index ac44e1becb2..9ad8be8ff35 100644
--- a/gui/widgets/list.cpp
+++ b/gui/widgets/list.cpp
@@ -174,7 +174,15 @@ int ListWidget::findDataIndex(int dataIndex) const {
 }
 
 void ListWidget::setSelected(int item) {
-	if (item < -1 || item >= (int)_list.size())
+	if (item == -1) {
+		// Clear selection
+		clearSelection();
+		_selectedItem = -1;
+		markAsDirty();
+		return;
+	}
+
+	if (item < 0 || item >= (int)_list.size())
 		return;
 
 	// We only have to do something if the widget is enabled and the selection actually changes




More information about the Scummvm-git-logs mailing list