]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Do not check GList/GSList references against NULL
authorJürg Billeter <j@bitron.ch>
Tue, 14 Apr 2009 18:35:31 +0000 (20:35 +0200)
committerJürg Billeter <j@bitron.ch>
Tue, 14 Apr 2009 18:35:31 +0000 (20:35 +0200)
NULL is a valid empty GList/GSList. Based on patch by Yu Feng,
fixes bug 578198.

gobject/valaccodebasemodule.vala

index 069be00ce6d950dfebbdc03eff14cea4827a4ddb..908b257d885ba95c4986d00371f9bef8006421c7 100644 (file)
@@ -3764,6 +3764,9 @@ internal class Vala.CCodeBaseModule : CCodeModule {
                        ccheck.add_argument (cexpr);
                } else if (!non_null) {
                        return null;
+               } else if (t == glist_type || t == gslist_type) {
+                       // NULL is empty list
+                       return null;
                } else {
                        var cnonnull = new CCodeBinaryExpression (CCodeBinaryOperator.INEQUALITY, new CCodeIdentifier (var_name), new CCodeConstant ("NULL"));
                        ccheck.add_argument (cnonnull);