Fix error message when no segments defined.

When no segments defined, R complained about arguments of length zero. Catch error before trying to parse.