Integrate David's fix for segfault when adding zero rows to a non-empty table.