[vala/0.34] genie: Add empty file check to read_token ()
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.34] genie: Add empty file check to read_token ()
- Date: Wed, 19 Oct 2016 10:24:47 +0000 (UTC)
commit 563fa08270e170d0d6fab4fdb78a6dd7706827f7
Author: Alistair Thomas <astavale yahoo co uk>
Date: Tue Oct 11 18:28:35 2016 +0100
genie: Add empty file check to read_token ()
Vala.SourceFile uses GLib.MappedFile.get_contents () to read a source
file. This can return null if the file is empty.
Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=633083
vala/valageniescanner.vala | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/vala/valageniescanner.vala b/vala/valageniescanner.vala
index e2c5466..95a8984 100644
--- a/vala/valageniescanner.vala
+++ b/vala/valageniescanner.vala
@@ -777,7 +777,11 @@ public class Vala.Genie.Scanner {
public TokenType read_token (out SourceLocation token_begin, out SourceLocation token_end) {
-
+ if (current == null) {
+ token_begin = SourceLocation (current, line, column);
+ token_end = SourceLocation (current, line, column);
+ return TokenType.EOF;
+ }
if (in_template ()) {
return read_template_token (out token_begin, out token_end);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]