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

S10.02-Solution-SmarterSyncing - possible NPE #148

Open
gshadows opened this issue Jan 28, 2018 · 0 comments
Open

S10.02-Solution-SmarterSyncing - possible NPE #148

gshadows opened this issue Jan 28, 2018 · 0 comments

Comments

@gshadows
Copy link

gshadows commented Jan 28, 2018

S10.02-Solution-SmarterSyncing - "SunshineSyncUtils.java"

Closing cursor without null check just after we assumed that it could be null.
Possible same issue could be in all future solutions. At least in S10.03 solution.

//  COMPLETED (6) If it is empty or we have a null Cursor, sync the weather now!
if (null == cursor || cursor.getCount() == 0) {
    startImmediateSync(context);
}
/* Make sure to close the Cursor to avoid memory leaks! */
cursor.close(); // --> This could cause NPE because we just assumed cursor could be null.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant