[vala/0.36] codegen: Guard get_default_ref_sink_function() against null base-class



commit 93a9c76484ba9d81e0c471a0fb29b0bb99cef25b
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Wed May 9 08:40:39 2018 +0200

    codegen: Guard get_default_ref_sink_function() against null base-class

 codegen/valaccodeattribute.vala |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/codegen/valaccodeattribute.vala b/codegen/valaccodeattribute.vala
index 69867fd..2bb0d37 100644
--- a/codegen/valaccodeattribute.vala
+++ b/codegen/valaccodeattribute.vala
@@ -836,7 +836,10 @@ public class Vala.CCodeAttribute : AttributeCache {
 
        private string get_default_ref_sink_function () {
                if (sym is Class) {
-                       return CCodeBaseModule.get_ccode_ref_sink_function (((Class) sym).base_class);
+                       unowned Class? base_class = ((Class) sym).base_class;
+                       if (base_class != null) {
+                               return CCodeBaseModule.get_ccode_ref_sink_function (base_class);
+                       }
                } else if (sym is Interface) {
                        foreach (var prereq in ((Interface) sym).get_prerequisites ()) {
                                string ref_sink_func = CCodeBaseModule.get_ccode_ref_sink_function 
((ObjectTypeSymbol) prereq.data_type);


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