Cornholio2108 / BestAlarm

0 stars 0 forks source link

Galaxy S9 issue #22

Closed Cornholio2108 closed 4 years ago

Cornholio2108 commented 4 years ago

java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.get(ArrayList.java:437) at com.awake.cornholio.awake.fragments.FragNewAlarm.onMapsFinished(FragNewAlarm.java:892) at com.awake.cornholio.awake.fragments.MapFragment$2.onClick(MapFragment.java:228)

Cornholio2108 commented 4 years ago
@Override
    public void onMapsFinished() {
        Log.d(TAG, "onMapsFinished: ");
        View view = getView().findViewById(R.id.incTraffic);
        EditText etTraffic = view.findViewById(R.id.etValue);
        //etTraffic.setText(destinationList.get(myPrefs.getInt(SP_SELECTED_DESTINATION,0)).name);
        //replace with:
        if(destinationList.size()>myPrefs.getInt(SP_SELECTED_DESTINATION,0))
             etTraffic.setText(destinationList.get(myPrefs.getInt(SP_SELECTED_DESTINATION,0)).name);
        else
             etTraffic.setText("Select destination");
    }
Cornholio2108 commented 4 years ago

Fixed