Skip to content

Commit

Permalink
get rid of uncatchable Objective-C exception in NSDictionary#{delete_…
Browse files Browse the repository at this point in the history
…if, select} which related to #124
  • Loading branch information
Watson1978 committed Jul 6, 2012
1 parent 73d6dc0 commit 7d8fcb4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions NSDictionary.m
Expand Up @@ -308,7 +308,8 @@
CHECK_MUTABLE(rcv);
RETURN_ENUMERATOR(rcv, 0, 0);
NSMutableArray *ary = [NSMutableArray new];
for (id key in rcv) {
// TODO: should handle the element which is inserted in iterator block.
for (id key in [rcv allKeys]) {
id value = [rcv objectForKey:key];
if (RTEST(rb_yield_values(2, OC2RB(key), OC2RB(value)))) {
[ary addObject:key];
Expand All @@ -325,7 +326,8 @@
CHECK_MUTABLE(rcv);
RETURN_ENUMERATOR(rcv, 0, 0);
NSMutableDictionary *dict = [NSMutableDictionary new];
for (id key in rcv) {
// TODO: should handle the element which is inserted in iterator block.
for (id key in [rcv allKeys]) {
id value = [rcv objectForKey:key];
if (RTEST(rb_yield_values(2, OC2RB(key), OC2RB(value)))) {
TRY_MOP([dict setObject:value forKey:key]);
Expand Down

0 comments on commit 7d8fcb4

Please sign in to comment.