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

T08.03-Solution-FinishQuizExample - Possible NullPointerException #259

Open
ramona-cristea opened this issue Jan 3, 2018 · 2 comments
Open

Comments

@ramona-cristea
Copy link

ramona-cristea commented Jan 3, 2018

There is a check for null cursor only in nextWord & showDefinition methods. But in AsyncTask method onPostExecute when you perform getColumnIndex on the cursor, or in onDestroy method where you close the cursor, there is no such check. Why is that? The query method definition says it can return a null cursor. Shouldn’t we check all the time that the cursor is not null before doing any actions with it? Otherwise we will get NullPointerException & the app will crash.

@mamuleanu
Copy link

mamuleanu commented Jan 4, 2018

@ramona-cristea Please check this

@ramona-cristea
Copy link
Author

@mamuleanu Hi. I think you misunderstood me. I do not have any problem with the code in my exercise. Everything is working fine. I only reported the issue because the code in solution project might throw a null pointer exception in some cases: E.g in case the query method returns a null cursor. I guess this is only useful in case the Udacity team thinks to update the repositories at some point and improve the code.

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

2 participants