summaryrefslogtreecommitdiff
path: root/vala/valageniescanner.vala
diff options
context:
space:
mode:
authorAlistair Thomas <astavale@yahoo.co.uk>2016-10-11 18:28:35 +0100
committerRico Tzschichholz <ricotz@ubuntu.com>2016-10-12 12:43:49 +0200
commita4ab6177c9a659b4b76f4fd22aedbb4b22920c55 (patch)
tree7a16559aea0292000d06b5a7595627f6796cdf59 /vala/valageniescanner.vala
parent213cec89aa3dcb234e3d41437adb99e7171e4a4b (diff)
downloadvala-a4ab6177c9a659b4b76f4fd22aedbb4b22920c55.tar.gz
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
Diffstat (limited to 'vala/valageniescanner.vala')
-rw-r--r--vala/valageniescanner.vala6
1 files changed, 5 insertions, 1 deletions
diff --git a/vala/valageniescanner.vala b/vala/valageniescanner.vala
index e2c5466b5..95a89842d 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);