Fix null pointer access in array iterator operations
This commit is contained in:
parent
7177386801
commit
968e74b182
@ -75,7 +75,7 @@ RJP_index rjp_num_elements(const RJP_value* array){
|
||||
}
|
||||
|
||||
void rjp_init_array_iterator(RJP_array_iterator* iter, const RJP_value* array){
|
||||
iter->current = &(array->array.elements->value);
|
||||
iter->current = (RJP_value*)(array->array.elements);
|
||||
}
|
||||
void rjp_delete_array_iterator(RJP_array_iterator* it){
|
||||
if(!it)
|
||||
@ -87,7 +87,7 @@ RJP_value* rjp_array_iterator_current(const RJP_array_iterator* it){
|
||||
}
|
||||
RJP_value* rjp_array_iterator_next(RJP_array_iterator* it){
|
||||
RJP_array_element* curr = (RJP_array_element*)it->current;
|
||||
it->current = curr ? &(curr->next->value) : NULL;
|
||||
it->current = curr ? (RJP_value*)(curr->next) : NULL;
|
||||
return it->current;
|
||||
}
|
||||
RJP_value* rjp_array_iterator_peek(const RJP_array_iterator* it){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user