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
9ed0a5d8ba
commit
1808c270e2
@ -186,12 +186,17 @@ public class GeckoNetworkManager
|
||||
private static NetworkType getNetworkType() {
|
||||
ConnectivityManager cm =
|
||||
(ConnectivityManager)GeckoApp.mAppContext.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
|
||||
if (cm.getActiveNetworkInfo() == null) {
|
||||
if (cm == null) {
|
||||
Log.e("GeckoNetworkManager", "Connectivity service does not exist");
|
||||
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 +212,10 @@ public class GeckoNetworkManager
|
||||
|
||||
TelephonyManager tm =
|
||||
(TelephonyManager)GeckoApp.mAppContext.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
if (tm == null) {
|
||||
Log.e("GeckoNetworkManager", "Telephony service does not exist");
|
||||
return NetworkType.NETWORK_UNKNOWN;
|
||||
}
|
||||
|
||||
switch (tm.getNetworkType()) {
|
||||
case TelephonyManager.NETWORK_TYPE_IDEN:
|
||||
|
Loading…
Reference in New Issue
Block a user