Blob Blame History Raw
diff -rupN --no-dereference ceres-solver-1.14.0/internal/ceres/compressed_row_sparse_matrix.cc ceres-solver-1.14.0-new/internal/ceres/compressed_row_sparse_matrix.cc
--- ceres-solver-1.14.0/internal/ceres/compressed_row_sparse_matrix.cc	2018-03-23 15:44:36.000000000 +0100
+++ ceres-solver-1.14.0-new/internal/ceres/compressed_row_sparse_matrix.cc	2019-11-13 12:18:47.049980244 +0100
@@ -196,6 +196,11 @@ CompressedRowSparseMatrix* CompressedRow
   CompressedRowSparseMatrix* output =
       new CompressedRowSparseMatrix(num_rows, num_cols, input.num_nonzeros());
 
+  if (num_rows == 0) {
+    // No data to copy.
+    return output;
+  }
+
   // Copy the contents of the cols and values array in the order given
   // by index and count the number of entries in each row.
   int* output_rows = output->mutable_rows();