Bug 1095914 - Fix NPE due to no telephony manager. r=vng

https://github.com/mozilla/MozStumbler/pull/1194
1185 NPE Reporter.startup (no telephony manager)
This commit is contained in:
Garvan Keeley 2014-11-08 09:08:00 -05:00
Родитель 53995c07d7
Коммит 4e4b118fd8
1 изменённых файлов: 6 добавлений и 1 удалений

Просмотреть файл

@ -63,7 +63,12 @@ public final class Reporter extends BroadcastReceiver {
mContext = context.getApplicationContext();
TelephonyManager tm = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
mPhoneType = tm.getPhoneType();
if (tm != null) {
mPhoneType = tm.getPhoneType();
} else {
Log.d(LOG_TAG, "No telephony manager.");
mPhoneType = TelephonyManager.PHONE_TYPE_NONE;
}
mIsStarted = true;