[Scummvm-git-logs] scummvm master -> 20e09e6d564db6560c9d94ae9eb50d8181c7f984

criezy criezy at scummvm.org
Tue Dec 29 23:31:11 UTC 2020


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

Summary:
20e09e6d56 GUI: Fix crash in setSelected() when the list index is empty


Commit: 20e09e6d564db6560c9d94ae9eb50d8181c7f984
    https://github.com/scummvm/scummvm/commit/20e09e6d564db6560c9d94ae9eb50d8181c7f984
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2020-12-29T23:31:07Z

Commit Message:
GUI: Fix crash in setSelected() when the list index is empty

If the list is filtered, but _listIndex is empty, setSelected() would
trigger trigger an assertion because it tried to use the index value
from the unfiltered list. This would happen in the ScummVM launcher if
you filtered the list and then edited the game titles until nothing
matched your search condition any more.

Instead of checking if there is a filtered list, check if there is a
filter or not. That should hold true whether or not the filter actually
matched anything.

Changed paths:
    gui/widgets/list.cpp


diff --git a/gui/widgets/list.cpp b/gui/widgets/list.cpp
index ef8329bee5..244939edd9 100644
--- a/gui/widgets/list.cpp
+++ b/gui/widgets/list.cpp
@@ -123,7 +123,7 @@ void ListWidget::setSelected(int item) {
 	// HACK/FIXME: If our _listIndex has a non zero size,
 	// we will need to look up, whether the user selected
 	// item is present in that list
-	if (_listIndex.size()) {
+	if (!_filter.empty()) {
 		int filteredItem = -1;
 
 		for (uint i = 0; i < _listIndex.size(); ++i) {




More information about the Scummvm-git-logs mailing list