the_Foundation [release-1.0]

Array: Fixed iteration of an empty array

=> 0290312eb606aa71e95f21d65307b94e612f6c48

diff --git a/src/array.c b/src/array.c
index 7a9a935..e3b934a 100644
--- a/src/array.c
+++ b/src/array.c
@@ -373,8 +373,13 @@ void remove_ArrayIterator(iArrayIterator *d) {
 void init_ArrayConstIterator(iArrayConstIterator *d, const iArray *array) {
     if (array) {
         d->array = array;
-        d->value = (!isEmpty_Array(array) ? constFront_Array(array) : NULL);
-        d->end = element_Array_(d->array, d->array->range.end);
+        if (!isEmpty_Array(array)) {
+            d->value = constFront_Array(array);
+            d->end   = element_Array_(d->array, d->array->range.end);
+        }
+        else {
+            d->value = d->end = NULL;
+        }
     }
     else {
         iZap(*d);
Proxy Information
Original URL
gemini://git.skyjake.fi/the_Foundation/release-1.0/cdiff/0290312eb606aa71e95f21d65307b94e612f6c48
Status Code
Success (20)
Meta
text/gemini; charset=utf-8
Capsule Response Time
28.457678 milliseconds
Gemini-to-HTML Time
0.25771 milliseconds

This content has been proxied by September (ba2dc).