src: remove some `call on nullable` warning with a non-null local variable
[nit.git] / src / model / mmodule.nit
index 7e2e9b3..c637c41 100644 (file)
@@ -22,7 +22,11 @@ import mpackage
 private import more_collections
 
 # The container class of a Nit object-oriented model.
+#
 # A model knows modules, classes and properties and can retrieve them.
+#
+# However, a model is not a program or a library as it can contains modules
+# found by the system (including broken ones) but not used.
 redef class Model
        # All known modules
        var mmodules = new Array[MModule]
@@ -61,6 +65,7 @@ redef class MGroup
        redef fun mdoc_or_fallback
        do
                if mdoc != null then return mdoc
+               var default_mmodule = self.default_mmodule
                if default_mmodule == null then return null
                return default_mmodule.mdoc_or_fallback
        end
@@ -160,6 +165,7 @@ class MModule
        do
                model.mmodules_by_name.add_one(name, self)
                model.mmodules.add(self)
+               var mgroup = self.mgroup
                if mgroup != null then
                        mgroup.mmodules.add(self)
                        if mgroup.name == name then