Skip to content

Commit

Permalink
Merge pull request #697 from rksh/null_check_route_list
Browse files Browse the repository at this point in the history
[FIX] Null check route list
  • Loading branch information
bobzilladev authored Apr 2, 2024
2 parents 529c09e + 291da61 commit ac310fe
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,16 @@ private void setupList() {
RecyclerView recyclerView = findViewById(R.id.gpx_list);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.addItemDecoration(new DividerItemDecoration(recyclerView.getContext(), DividerItemDecoration.VERTICAL));
try {
Cursor cursor = dbHelper.routeMetaIterator();
final DateFormat itemDateFormat = android.text.format.DateFormat.getDateFormat(this.getApplicationContext());
final DateFormat itemTimeFormat = android.text.format.DateFormat.getTimeFormat(this.getApplicationContext());
GpxRecyclerAdapter adapter = new GpxRecyclerAdapter(this, this, cursor, this, this, prefs, itemDateFormat, itemTimeFormat);
recyclerView.setAdapter(adapter);
} catch (DBException dbex) {
Logging.error("Failed to setup list for GPX management: ", dbex);
if (null != dbHelper) {
try {
Cursor cursor = dbHelper.routeMetaIterator();
final DateFormat itemDateFormat = android.text.format.DateFormat.getDateFormat(this.getApplicationContext());
final DateFormat itemTimeFormat = android.text.format.DateFormat.getTimeFormat(this.getApplicationContext());
GpxRecyclerAdapter adapter = new GpxRecyclerAdapter(this, this, cursor, this, this, prefs, itemDateFormat, itemTimeFormat);
recyclerView.setAdapter(adapter);
} catch (DBException dbex) {
Logging.error("Failed to setup list for GPX management: ", dbex);
}
}
}

Expand Down

0 comments on commit ac310fe

Please sign in to comment.