Don't call np.roll on empty arrays.

On some versions of numpy (such as 1.7, but not 1.8), this throws a
ZeroDivisionError.

Fixes #8019.