From aa801abe3aab9a891e3ba4d0fcb20aaca0b5959c Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Mon, 17 Dec 2012 12:27:00 +0100 Subject: Refactoring: simplify code --- main/src/cgeo/geocaching/cgData.java | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'main/src') diff --git a/main/src/cgeo/geocaching/cgData.java b/main/src/cgeo/geocaching/cgData.java index 5d4cddb..a490562 100644 --- a/main/src/cgeo/geocaching/cgData.java +++ b/main/src/cgeo/geocaching/cgData.java @@ -2206,7 +2206,7 @@ public class cgData { } try { - Cursor cursor = database.query( + final Cursor cursor = database.query( dbTableCaches, new String[]{"geocode"}, selection.toString(), @@ -2215,22 +2215,10 @@ public class cgData { null, "visiteddate", null); - - if (cursor != null) { - if (cursor.getCount() > 0) { - cursor.moveToFirst(); - int index = cursor.getColumnIndex("geocode"); - - do { - geocodes.add(cursor.getString(index)); - } while (cursor.moveToNext()); - } else { - cursor.close(); - return null; - } - - cursor.close(); + while (cursor.moveToNext()) { + geocodes.add(cursor.getString(0)); } + cursor.close(); } catch (Exception e) { Log.e("cgData.loadBatchOfHistoricGeocodes: " + e.toString()); } -- cgit v1.1