[vala/staging] vala: Never add "null" in ForeachStatement.get_defined_variables()



commit c24a807efe5f06e04d6839a48521730d20769045
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Wed Feb 19 07:36:30 2020 +0100

    vala: Never add "null" in ForeachStatement.get_defined_variables()
    
    See https://gitlab.gnome.org/GNOME/vala/issues/911

 vala/valaforeachstatement.vala | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/vala/valaforeachstatement.vala b/vala/valaforeachstatement.vala
index 67063bbe1..5159c2b3f 100644
--- a/vala/valaforeachstatement.vala
+++ b/vala/valaforeachstatement.vala
@@ -410,6 +410,8 @@ public class Vala.ForeachStatement : Block {
        }
 
        public override void get_defined_variables (Collection<Variable> collection) {
-               collection.add (element_variable);
+               if (element_variable != null) {
+                       collection.add (element_variable);
+               }
        }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]