]> 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>
Mon, 15 Mar 2021 15:02:29 +0000 (16:02 +0100)
vala/valagirparser.vala

index ddd511f240169d8b48bc2c10ba5b1746a77f149c..3a0838dea8198fa513e713020c605ce19b002a6a 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) {