aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/vala/files/0014-GError-Fix-error-propagation-in-creation-methods.patch
blob: 1c697ef8ab93ee3eabd68e4339996a27a2cf04af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
From fe541bc5cd9d84a567705b72777c2b2117c85aef Mon Sep 17 00:00:00 2001
From: =?utf-8?q?J=C3=BCrg=20Billeter?= <j@bitron.ch>
Date: Wed, 30 Sep 2009 19:28:37 +0200
Subject: [PATCH] GError: Fix error propagation in creation methods

---
 codegen/valagerrormodule.vala |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/codegen/valagerrormodule.vala b/codegen/valagerrormodule.vala
index 9d624de..2f1d385 100644
--- a/codegen/valagerrormodule.vala
+++ b/codegen/valagerrormodule.vala
@@ -116,7 +116,11 @@ internal class Vala.GErrorModule : CCodeDelegateModule {
 		append_local_free (current_symbol, free_frag, false);
 		cerror_block.add_statement (free_frag);
 
-		if (current_return_type is VoidType) {
+		if (current_method is CreationMethod) {
+			cerror_block.add_statement (new CCodeReturnStatement (new CCodeConstant ("NULL")));
+		} else if (current_method != null && current_method.coroutine) {
+			cerror_block.add_statement (new CCodeReturnStatement (new CCodeConstant ("FALSE")));
+		} else if (current_return_type is VoidType) {
 			cerror_block.add_statement (new CCodeReturnStatement ());
 		} else {
 			cerror_block.add_statement (new CCodeReturnStatement (default_value_for_type (current_return_type, false)));
-- 
1.6.0.4