fix #938: check hasActivity in onPostExecute to avoid a npe