fix #7650 reshape of empty sparse matrices

Checking length of `rowval` before reducing for maximum.