summaryrefslogtreecommitdiff
path: root/codegen/valagirwriter.vala
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2010-02-07 11:23:48 +0100
committerJürg Billeter <j@bitron.ch>2010-02-07 11:23:48 +0100
commit3587d178d7f612de8862ef23d3ab8e464aea4e16 (patch)
treeb8f78575a0b0ab47a83788d263483b5ee48ada22 /codegen/valagirwriter.vala
parent75008bd52c6676747e7b75fede1b063d04536d4a (diff)
downloadvala-3587d178d7f612de8862ef23d3ab8e464aea4e16.tar.gz
Fix crash when opening file fails
Based on patch by pancake, fixes bug 606837.
Diffstat (limited to 'codegen/valagirwriter.vala')
-rw-r--r--codegen/valagirwriter.vala6
1 files changed, 5 insertions, 1 deletions
diff --git a/codegen/valagirwriter.vala b/codegen/valagirwriter.vala
index f9c5f3ce8..fd90f85ef 100644
--- a/codegen/valagirwriter.vala
+++ b/codegen/valagirwriter.vala
@@ -1,6 +1,6 @@
/* valagirwriter.vala
*
- * Copyright (C) 2008-2009 Jürg Billeter
+ * Copyright (C) 2008-2010 Jürg Billeter
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -87,6 +87,10 @@ public class Vala.GIRWriter : CodeVisitor {
string filename = "%s%c%s-%s.gir".printf (directory, Path.DIR_SEPARATOR, gir_namespace, gir_version);
stream = FileStream.open (filename, "w");
+ if (stream == null) {
+ Report.error (null, "unable to open `%s' for writing".printf (filename));
+ return;
+ }
stream.printf ("<?xml version=\"1.0\"?>\n");