handling NPE in Profiles and communities
correcting the error message
Merge pull request #361 from swatisingh10/FixForCommunityAndProfilesSamples

handling NPE in Profiles and communities