Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException exception with isDeviceConnectedToMobileOrWifiNetwork() #57

Closed
jewom opened this issue Jul 4, 2017 · 2 comments
Closed
Assignees
Labels
Bug Unexpected/bad behavior Status - Fix Released A bug fix that has been released
Milestone

Comments

@jewom
Copy link

jewom commented Jul 4, 2017

Hi,

When I use : mWiseFy.isDeviceConnectedToMobileOrWifiNetwork()

I have this error :

java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.net.NetworkInfo.isConnected()' on a null object reference
at com.isupatches.wisefy.WiseFy.isDeviceConnectedToMobileOrWifiNetwork(WiseFy.java:578)

It seem sometimes it's working and sometimes not...

@isuPatches isuPatches self-assigned this Jul 4, 2017
@isuPatches isuPatches added the Bug Unexpected/bad behavior label Jul 4, 2017
@isuPatches
Copy link
Owner

I can fix that one too with the next release...that's because for safety:

if (networkInfo.isConnected() && networkInfo.isAvailable()) {
should be:

if (networkInfo != null && networkInfo.isConnected() && networkInfo.isAvailable()) {

I bet in some cases networkInfo is null.

@isuPatches isuPatches changed the title mWiseFy.isDeviceConnectedToMobileOrWifiNetwork() NullPointerException exception with isDeviceConnectedToMobileOrWifiNetwork() Jul 4, 2017
@isuPatches
Copy link
Owner

Please try 1.0.10 when you get a chance...thank you :)

@isuPatches isuPatches added 1.x Status - Released Work that has been released labels Dec 10, 2017
@isuPatches isuPatches added this to the 1.0.10 milestone Dec 14, 2019
@isuPatches isuPatches added Status - Fix Released A bug fix that has been released and removed Status - Released Work that has been released labels Jan 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Unexpected/bad behavior Status - Fix Released A bug fix that has been released
Projects
None yet
Development

No branches or pull requests

2 participants