]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Fix crash when unable to infer generic type arguments
authorJürg Billeter <j@bitron.ch>
Sun, 21 Mar 2010 18:44:58 +0000 (19:44 +0100)
committerJürg Billeter <j@bitron.ch>
Sun, 21 Mar 2010 18:44:58 +0000 (19:44 +0100)
vala/valamethodcall.vala

index 01adb4f9ab9a044f2d1aa597a436d13f353632e2..a148699860888f381182b70ea42d19725f505105 100644 (file)
@@ -580,7 +580,7 @@ public class Vala.MethodCall : Expression {
                                                }
 
                                                // infer type arguments from expected return type
-                                               if (type_arg == null) {
+                                               if (type_arg == null && target_type != null) {
                                                        var generic_type = m.return_type as GenericType;
                                                        if (generic_type != null && generic_type.type_parameter == type_param) {
                                                                type_arg = target_type.copy ();
@@ -589,7 +589,9 @@ public class Vala.MethodCall : Expression {
                                                }
 
                                                if (type_arg == null) {
+                                                       error = true;
                                                        Report.error (ma.source_reference, "cannot infer generic type argument for type parameter `%s'".printf (type_param.get_full_name ()));
+                                                       return false;
                                                }
 
                                                ma.add_type_argument (type_arg);