Update index.js

Make sure that the user object exists before trying to inspect properties on user.