Don't pass negative values to setSelectionFromTop()

This commit is contained in:
Peter Osterlund 2019-09-28 08:01:41 +02:00
parent 3ff78c2cbf
commit 8e42ee8022

View File

@ -272,7 +272,8 @@ public abstract class EditPGN extends AppCompatActivity {
ListView lv = binding.listView;
currentFilePos = defaultFilePos;
int itemNo = getItemNo(gamesInFile, defaultFilePos);
lv.setSelectionFromTop(itemNo, 0);
if (itemNo >= 0)
lv.setSelectionFromTop(itemNo, 0);
lv.setFastScrollEnabled(true);
lv.setOnItemClickListener((parent, view, pos, id) -> {
selectedGi = aa.getItem(pos);