mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 746938 - Prevent NullPointerException in getNetworkType; r=mounir
This commit is contained in:
parent
29bff9dcd8
commit
87a7e9e00d
@ -186,11 +186,18 @@ public class GeckoNetworkManager
|
||||
ConnectivityManager cm =
|
||||
(ConnectivityManager)GeckoApp.mAppContext.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
|
||||
if (cm.getActiveNetworkInfo() == null) {
|
||||
if (cm == null) {
|
||||
Log.w("GeckoNetworkManager", "Could not access Connectivity service");
|
||||
return NetworkType.NETWORK_NONE;
|
||||
}
|
||||
|
||||
switch (cm.getActiveNetworkInfo().getType()) {
|
||||
NetworkInfo ni = cm.getActiveNetworkInfo();
|
||||
|
||||
if (ni == null) {
|
||||
return NetworkType.NETWORK_NONE;
|
||||
}
|
||||
|
||||
switch (ni.getType()) {
|
||||
case ConnectivityManager.TYPE_ETHERNET:
|
||||
return NetworkType.NETWORK_ETHERNET;
|
||||
case ConnectivityManager.TYPE_WIFI:
|
||||
@ -207,6 +214,11 @@ public class GeckoNetworkManager
|
||||
TelephonyManager tm =
|
||||
(TelephonyManager)GeckoApp.mAppContext.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
|
||||
if (tm == null) {
|
||||
Log.w("GeckoNetworkManager", "Could not access Telephony service");
|
||||
return NetworkType.NETWORK_UNKNOWN;
|
||||
}
|
||||
|
||||
switch (tm.getNetworkType()) {
|
||||
case TelephonyManager.NETWORK_TYPE_IDEN:
|
||||
case TelephonyManager.NETWORK_TYPE_CDMA:
|
||||
|
Loading…
Reference in New Issue
Block a user