Added null check.
Updated comments and return of null in getCategories().
Updated handling of chosen category and errortext if no categories could be retreived.