summaryrefslogtreecommitdiff
path: root/libvaladoc
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2021-03-20 16:19:35 +0100
committerRico Tzschichholz <ricotz@ubuntu.com>2021-03-20 16:19:35 +0100
commit6bda851954033cd570882517a464f78aff23a2f2 (patch)
tree0f97fb0467c0d98854eb2ae0dbb38d9dfdc782cd /libvaladoc
parent68ef9751c57b408e2199ed3fb739f8c5ad0ee60c (diff)
downloadvala-6bda851954033cd570882517a464f78aff23a2f2.tar.gz
libvaladoc/girimporter: Don't guess length of xml header, iterate forward to <repository>
If e.g. the xml header is missing, it resulted in errors like: error: expected start element of `repository' error: unsupported GIR version (null) (supported: 1.2)
Diffstat (limited to 'libvaladoc')
-rw-r--r--libvaladoc/importer/girdocumentationimporter.vala10
1 files changed, 7 insertions, 3 deletions
diff --git a/libvaladoc/importer/girdocumentationimporter.vala b/libvaladoc/importer/girdocumentationimporter.vala
index b7d475043..e0ae01d6c 100644
--- a/libvaladoc/importer/girdocumentationimporter.vala
+++ b/libvaladoc/importer/girdocumentationimporter.vala
@@ -69,10 +69,14 @@ public class Valadoc.Importer.GirDocumentationImporter : DocumentationImporter {
this.reader = new Vala.MarkupReader (source_file);
// xml prolog
- next ();
- next ();
+ do {
+ next ();
+ if (current_token == Vala.MarkupTokenType.EOF) {
+ error ("unexpected end of file");
+ return;
+ }
+ } while (current_token != Vala.MarkupTokenType.START_ELEMENT && reader.name != "repository");
- next ();
parse_repository ();
reader = null;