Added null check to selectObject().