From: Alistair Thomas Date: Tue, 11 Oct 2016 17:28:35 +0000 (+0100) Subject: genie: Add empty file check to read_token () X-Git-Tag: 0.35.1~94 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a4ab6177c9a659b4b76f4fd22aedbb4b22920c55;p=thirdparty%2Fvala.git 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 --- 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);