Revision
2780
Author
lsansonetti@apple.com
Date
2009-10-10 13:28:31 -0700 (Sat, 10 Oct 2009)

Log Message

when handling a sel_of_type argument, handle the case when the selector may be nil

Modified Paths

Diff

Modified: MacRuby/trunk/dispatcher.cpp (2779 => 2780)


--- MacRuby/trunk/dispatcher.cpp	2009-10-10 06:25:33 UTC (rev 2779)
+++ MacRuby/trunk/dispatcher.cpp	2009-10-10 20:28:31 UTC (rev 2780)
@@ -816,18 +816,20 @@
 		    // call is the future target.
 		    const int arg_i = arg->index;
 		    assert(arg_i >= 0);
-		    ID arg_selid = rb_to_id(argv[arg_i]);
-		    SEL arg_sel = sel_registerName(rb_id2name(arg_selid));
+		    if (argv[arg_i] != Qnil) {
+			ID arg_selid = rb_to_id(argv[arg_i]);
+			SEL arg_sel = sel_registerName(rb_id2name(arg_selid));
 
-		    if (reinstall_method_maybe(*(Class *)ocrcv, arg_sel,
-			    arg->sel_of_type)) {
-			goto sel_target_found;
-		    }
-		    for (int j = 0; j < argc; j++) {
-			if (j != arg_i && !SPECIAL_CONST_P(argv[j])) {
-			    if (reinstall_method_maybe(*(Class *)argv[j],
-					arg_sel, arg->sel_of_type)) {
-				goto sel_target_found;
+			if (reinstall_method_maybe(*(Class *)ocrcv, arg_sel,
+				    arg->sel_of_type)) {
+			    goto sel_target_found;
+			}
+			for (int j = 0; j < argc; j++) {
+			    if (j != arg_i && !SPECIAL_CONST_P(argv[j])) {
+				if (reinstall_method_maybe(*(Class *)argv[j],
+					    arg_sel, arg->sel_of_type)) {
+				    goto sel_target_found;
+				}
 			    }
 			}
 		    }