Added null checks in ASyncTask.