]> 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:33 +0000 (21:42 +0200)
Regression of 049b9b3943831e6dd242889a8196bd88b7858268

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

index 2a2eb249d8f251f7e0deb696e24cebbe2077501c..310135f78304dd31c55af371320f63a7ceacda68 100644 (file)
@@ -364,7 +364,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);