From 8e42ee80222e8e91cbc54df3abf13003109dbd5d Mon Sep 17 00:00:00 2001 From: Peter Osterlund Date: Sat, 28 Sep 2019 08:01:41 +0200 Subject: [PATCH] Don't pass negative values to setSelectionFromTop() --- .../src/main/java/org/petero/droidfish/activities/EditPGN.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DroidFishApp/src/main/java/org/petero/droidfish/activities/EditPGN.java b/DroidFishApp/src/main/java/org/petero/droidfish/activities/EditPGN.java index 02d56cd..bea3681 100644 --- a/DroidFishApp/src/main/java/org/petero/droidfish/activities/EditPGN.java +++ b/DroidFishApp/src/main/java/org/petero/droidfish/activities/EditPGN.java @@ -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);