expand.grid fails if any of the arguments are zero length:
> expand.grid(1:2, 1, seq_len(0))
Error in rep.int(rep.int(seq_len(nx), rep.int(rep.fac, nx)), orep) :
invalid number of copies in rep.int()
I think it would be desirable if it output a data frame with zero rows.