[libr] Initialize SetIterator the right way

I'd written Set.[rh] after the big rewrite so never noticed the access
error.
This commit is contained in:
Bill Currie 2020-03-03 10:43:29 +09:00
parent 16223098e5
commit c2138183dd

View file

@ -27,6 +27,15 @@ string set_as_string (set_t *set) = #0;
@implementation SetIterator: Object @implementation SetIterator: Object
- initWithIterator: (set_iter_t *) iter
{
if (!(self = [super init])) {
return nil;
}
self.iter = iter;
return self;
}
- (SetIterator *) next - (SetIterator *) next
{ {
if ((iter = set_next (iter))) if ((iter = set_next (iter)))
@ -84,8 +93,7 @@ string set_as_string (set_t *set) = #0;
if (!iter) if (!iter)
return nil; return nil;
iterator = [[SetIterator alloc] init]; iterator = [[SetIterator alloc] initWithIterator: iter];
iterator.iter = iter;
return iterator; return iterator;
} }