diff liboctave/array/Sparse.cc @ 32046:39700c1ea93e

maint: merge stable to default
author Rik <rik@octave.org>
date Thu, 20 Apr 2023 18:59:26 -0700
parents 21f9b34eb893 f18da620ab4d
children 1de97b475564
line wrap: on
line diff
--- a/liboctave/array/Sparse.cc	Thu Apr 20 16:49:31 2023 -0400
+++ b/liboctave/array/Sparse.cc	Thu Apr 20 18:59:26 2023 -0700
@@ -873,6 +873,9 @@
           octave_idx_type old_nr = rows ();
           octave_idx_type old_nc = cols ();
           retval = Sparse<T, Alloc> (new_nr, new_nc, new_nnz);
+          // Special case for empty matrices (bug #64080)
+          if (new_nr == 0 || new_nc == 0)
+            return retval;
 
           octave_idx_type kk = 0;
           retval.xcidx (0) = 0;