From: Jürg Billeter Date: Sun, 21 Mar 2010 18:44:58 +0000 (+0100) Subject: Fix crash when unable to infer generic type arguments X-Git-Tag: 0.8.0~100 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9f0dc9988023a561d312cfe2b98bc4cd2dfae1d9;p=thirdparty%2Fvala.git Fix crash when unable to infer generic type arguments --- diff --git a/vala/valamethodcall.vala b/vala/valamethodcall.vala index 01adb4f9a..a14869986 100644 --- a/vala/valamethodcall.vala +++ b/vala/valamethodcall.vala @@ -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);