diff --git a/src/edu/grinnell/glicious/menucontent/GetMenuTask.java b/src/edu/grinnell/glicious/menucontent/GetMenuTask.java index 4318cbf..c17621a 100644 --- a/src/edu/grinnell/glicious/menucontent/GetMenuTask.java +++ b/src/edu/grinnell/glicious/menucontent/GetMenuTask.java @@ -208,14 +208,18 @@ protected static boolean networkEnabled(ConnectivityManager connec) { return false; } - if (connec.getNetworkInfo(1) != null - && connec.getNetworkInfo(1).getState() == NetworkInfo.State.CONNECTED) - return true; - else if (connec.getNetworkInfo(0) != null - && connec.getNetworkInfo(0).getState() == NetworkInfo.State.CONNECTED) - return true; - else + try { + if (connec.getNetworkInfo(1) != null + && connec.getNetworkInfo(1).getState() == NetworkInfo.State.CONNECTED) + return true; + else if (connec.getNetworkInfo(0) != null + && connec.getNetworkInfo(0).getState() == NetworkInfo.State.CONNECTED) + return true; + else + return false; + } catch (NullPointerException exception) { return false; + } } /* Return true if the appropriate host can be reached. */