fix potential rare crash

This commit is contained in:
woheller69 2025-05-23 06:27:05 +02:00
parent 10f7c2f9f5
commit 02b78a99c9

View file

@ -311,6 +311,7 @@ public class CityWeatherAdapter extends RecyclerView.Adapter<CityWeatherAdapter.
new RecyclerItemClickListener(context, holder.recyclerView, new RecyclerItemClickListener.OnItemClickListener() {
@Override
public void onItemClick(View view, int position) {
if (position == -1) return;
SQLiteHelper database = SQLiteHelper.getInstance(context.getApplicationContext());
List<WeekForecast> weekforecasts = database.getWeekForecastsByCityId(generalDataList.getCity_id());
long time = weekforecasts.get(position).getForecastTime(); //time of clicked week item