Fix to issue number 1

Added a check for if the response is undefined or null (could happen if
no internet connection).