2

The app stopped during getting the location from Gps.

PrayerTimes Class

The app stopped during getting the location from Gps.

in these two lines

    public static Mazhab getDefaultMazhab(String countryCode) {
        countryCode = countryCode.toUpperCase();

        if("AF, AL, EG".contains (countryCode)) return Mazhab.PTC_MAZHAB_SHAFEI;

        return Mazhab.PTC_MAZHAB_HANAFI;
    }

    public static Way getDefaultWay(String countryCode) {
        countryCode = countryCode.toUpperCase();

        if("CM, CF, CD, CG, CI, EG, GH, IQ, KE, LY, MY, ML, SN, SO, SD, TN".indexOf(countryCode)>=0) return Way.PTC_WAY_EGYPT;

        if("AF, AL, BD, IN, PK, WF".indexOf(countryCode)>=0) return Way.PTC_WAY_KARACHI;

        if("CA, US".indexOf(countryCode)>=0) return Way.PTC_WAY_ISNA;

        if("BH, KW, OM, QA, SA, AE, YE".indexOf(countryCode)>=0) return Way.PTC_WAY_UMQURA;

        return Way.PTC_WAY_MWL;
    }
}

LogCat

from LogCat

Attempt to invoke virtual method 'java.lang.String java.lang.String.toUpperCase()' on a null object reference

at

at mindtrack.muslimorganizer.calculator.prayer.PrayerTimes.getDefaultMazhab(PrayerTimes.java:282)
        at mindtrack.muslimorganizer.ui.activity.MainActivity.onLocationChanged(MainActivity.java:324)
Community
  • 1
  • 1

1 Answers1

1

countryCode in getDefaultMazhab is null. Put if(countryCode!=null) before that line

MMG
  • 2,962
  • 5
  • 8
  • 35