]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
GError: Fix uncaught errors in creation methods
authorJürg Billeter <j@bitron.ch>
Wed, 8 Apr 2009 17:19:54 +0000 (19:19 +0200)
committerJürg Billeter <j@bitron.ch>
Sun, 12 Apr 2009 16:01:19 +0000 (18:01 +0200)
gobject/valagerrormodule.vala

index 01b6e14f3eff029d34d6c492f7eb66e7bf9f01fb..e443430879199525243a772e0dd19f56b8950dce 100644 (file)
@@ -134,7 +134,9 @@ internal class Vala.GErrorModule : CCodeDelegateModule {
                // print critical message
                cerror_block.add_statement (cprint_frag);
 
-               if (current_return_type is VoidType) {
+               if (current_method is CreationMethod) {
+                       cerror_block.add_statement (new CCodeReturnStatement (new CCodeConstant ("NULL")));
+               } else if (current_return_type is VoidType) {
                        cerror_block.add_statement (new CCodeReturnStatement ());
                } else if (current_return_type != null) {
                        cerror_block.add_statement (new CCodeReturnStatement (default_value_for_type (current_return_type, false)));