Catch the NullPointerException when the host is undefined