Added try, catch block

The try, catch block was added to MainActivity and is meant to handle a
missing activity exception.