diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2021-03-15 16:02:29 +0100 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2021-03-15 16:02:29 +0100 |
commit | 9dc7fb982602dd146de54a347c521889700d3a45 (patch) | |
tree | 041d3eee8eeacba879b902cd05576a7960528eb1 /vala | |
parent | 68bc3d01578dc4365e410d1afb9dd6faf61d52d9 (diff) | |
download | vala-9dc7fb982602dd146de54a347c521889700d3a45.tar.gz |
girparser: Handle empty "<type/>" element and report an error
Diffstat (limited to 'vala')
-rw-r--r-- | vala/valagirparser.vala | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala index ddd511f24..3a0838dea 100644 --- a/vala/valagirparser.vala +++ b/vala/valagirparser.vala @@ -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) { |