Fixed bugs - null object accesses

There were no checks made for when a user doesn’t choose any friends to
search within, causing execution to halt. Added checks for such cases.