From: Rico Tzschichholz Date: Thu, 4 Oct 2018 12:02:18 +0000 (+0200) Subject: codegen: Replace invalid array-length assert with internal error X-Git-Tag: 0.42.3~44 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=272855a9ebfabf80cbca96faa00acb948fae62bc;p=thirdparty%2Fvala.git codegen: Replace invalid array-length assert with internal error While the test-suite triggers this assert with an invalid test an explicit crash is not wanted. --- diff --git a/codegen/valaccodearraymodule.vala b/codegen/valaccodearraymodule.vala index cd9377512..32f42545c 100644 --- a/codegen/valaccodearraymodule.vala +++ b/codegen/valaccodearraymodule.vala @@ -147,7 +147,10 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule { } List size = ((GLibValue) value).array_length_cvalues; - assert (size != null && size.size >= dim); + if (size == null || size.size < dim) { + Report.error (null, "internal error: invalid array_length for given dimension"); + return new CCodeInvalidExpression (); + } return size[dim - 1]; }