summaryrefslogtreecommitdiff
path: root/ext/com_dotnet/com_iterator.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/com_dotnet/com_iterator.c')
-rw-r--r--ext/com_dotnet/com_iterator.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/com_dotnet/com_iterator.c b/ext/com_dotnet/com_iterator.c
index e6f5b84cbd..c3206497cf 100644
--- a/ext/com_dotnet/com_iterator.c
+++ b/ext/com_dotnet/com_iterator.c
@@ -187,7 +187,7 @@ zend_object_iterator *php_com_iter_get(zend_class_entry *ce, zval *object, int b
SafeArrayGetUBound(V_ARRAY(&I->safe_array), 1, &I->sa_max);
/* pre-fetch the element */
- if (php_com_safearray_get_elem(&I->safe_array, &I->v, bound)) {
+ if (I->sa_max >= bound && php_com_safearray_get_elem(&I->safe_array, &I->v, bound)) {
I->key = bound;
ZVAL_NULL(&ptr);
php_com_zval_from_variant(&ptr, &I->v, I->code_page);