]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Avoid critical for array in-parameters with custom length-type
authorRico Tzschichholz <ricotz@ubuntu.com>
Mon, 21 May 2018 19:33:16 +0000 (21:33 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Mon, 21 May 2018 19:42:23 +0000 (21:42 +0200)
Regression of 049b9b3943831e6dd242889a8196bd88b7858268

codegen/valaccodemethodcallmodule.vala
tests/methods/bug634753.vala

index 2c74f2cecfeecdd594c0d964216f4f40806c0015..14620ae353a9ef016ee92e01c0a4d949f1b9db62 100644 (file)
@@ -356,7 +356,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
                                                                CCodeExpression? array_length_expr = null;
                                                                if (get_ccode_array_length_type (param) != null) {
                                                                        string length_ctype = get_ccode_array_length_type (param);
-                                                                       if (unary.operator == UnaryOperator.REF) {
+                                                                       if (unary != null && unary.operator == UnaryOperator.REF) {
                                                                                length_ctype = "%s*".printf (length_ctype);
                                                                        }
                                                                        array_length_expr = new CCodeCastExpression (get_array_length_cexpression (arg, dim), length_ctype);
index c33f44a79744ad1b85472145fa684311445519fe..9b5ad85e62d21859132256d75a1713ce4741b531 100644 (file)
@@ -1,6 +1,9 @@
 void foo ([CCode (array_length_type = "gsize")] ref uint8[] a) {
 }
 
+void bar ([CCode (array_length_type = "gsize")] uint8[] a) {
+}
+
 void main () {
        uint8[] a = new uint8[32];
        foo (ref a);