]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
girparser: Handle empty "<type/>" element and report an error
authorRico Tzschichholz <ricotz@ubuntu.com>
Mon, 15 Mar 2021 15:02:29 +0000 (16:02 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Thu, 18 Mar 2021 09:13:59 +0000 (10:13 +0100)
vala/valagirparser.vala

index 02bc640ea2a227713ff6d160de8860e91bbcd010..34a74e252c405ef1b7fc6669e26686fd12b2e599 100644 (file)
@@ -2748,7 +2748,16 @@ public class Vala.GirParser : CodeVisitor {
                        type_name = ctype;
                }
 
-               DataType type = parse_type_from_gir_name (type_name, out no_array_length, out array_null_terminated, ctype);
+               DataType type;
+               if (type_name != null) {
+                       type = parse_type_from_gir_name (type_name, out no_array_length, out array_null_terminated, ctype);
+               } else {
+                       // empty <type/>
+                       no_array_length = false;
+                       array_null_terminated = false;
+                       type = new InvalidType ();
+                       Report.error (get_current_src (), "empty type element");
+               }
 
                // type arguments / element types
                while (current_token == MarkupTokenType.START_ELEMENT) {