Added checks to see if the provided app for custom authentication is null. Prevents NullPointerException.