[vala/staging] libvaladoc/girimporter: Don't guess length of xml header, iterate forward to <repository>
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] libvaladoc/girimporter: Don't guess length of xml header, iterate forward to <repository>
- Date: Sat, 20 Mar 2021 15:21:33 +0000 (UTC)
commit 6bda851954033cd570882517a464f78aff23a2f2
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sat Mar 20 16:19:35 2021 +0100
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)
libvaladoc/importer/girdocumentationimporter.vala | 10 +++++++---
1 file 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]