twfb: Ensure number of rows is >0 before calling calloc()