a0c8d77
diff -rupN ceres-solver-1.13.0/internal/ceres/compressed_row_sparse_matrix.cc ceres-solver-1.13.0-new/internal/ceres/compressed_row_sparse_matrix.cc
a0c8d77
--- ceres-solver-1.13.0/internal/ceres/compressed_row_sparse_matrix.cc	2017-08-03 09:10:55.000000000 +0200
a0c8d77
+++ ceres-solver-1.13.0-new/internal/ceres/compressed_row_sparse_matrix.cc	2018-07-28 22:31:51.989682309 +0200
a0c8d77
@@ -196,6 +196,11 @@ CompressedRowSparseMatrix* CompressedRow
a0c8d77
   CompressedRowSparseMatrix* output =
a0c8d77
       new CompressedRowSparseMatrix(num_rows, num_cols, input.num_nonzeros());
a0c8d77
 
a0c8d77
+  if (num_rows == 0) {
a0c8d77
+    // No data to copy.
a0c8d77
+    return output;
a0c8d77
+  }
a0c8d77
+
a0c8d77
   // Copy the contents of the cols and values array in the order given
a0c8d77
   // by index and count the number of entries in each row.
a0c8d77
   int* output_rows = output->mutable_rows();