You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
@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.
There is a check for null cursor only in
nextWord
&showDefinition
methods. But inAsyncTask
methodonPostExecute
when you performgetColumnIndex
on the cursor, or inonDestroy
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.The text was updated successfully, but these errors were encountered: