summaryrefslogtreecommitdiff
path: root/libguile/array-handle.c
diff options
context:
space:
mode:
Diffstat (limited to 'libguile/array-handle.c')
-rw-r--r--libguile/array-handle.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libguile/array-handle.c b/libguile/array-handle.c
index 3d81efc04..947462a59 100644
--- a/libguile/array-handle.c
+++ b/libguile/array-handle.c
@@ -149,8 +149,10 @@ initialize_vector_handle (scm_t_array_handle *h, size_t len,
h->dim0.ubnd = (ssize_t) (len - 1U);
h->dim0.inc = 1;
h->element_type = element_type;
- h->elements = elements;
- h->writable_elements = mutable_p ? ((void *) elements) : NULL;
+ /* elements != writable_elements is used to check mutability later on.
+ Ignore it if the array is empty. */
+ h->elements = len==0 ? NULL : elements;
+ h->writable_elements = mutable_p ? ((void *) h->elements) : NULL;
h->vector = h->array;
h->vref = vref;
h->vset = vset;