lib/standard/string: Fix the case of null items in FlatBuffer when calling to_s
[nit.git] / src / android_annotations.nit
index 58c6a0c..ec0d2dc 100644 (file)
@@ -76,13 +76,31 @@ redef class ModelBuilder
                if annot != null then project.java_package = annot.arg_as_string(self)
 
                var annots = collect_annotations_on_modules("min_api_version", mmodule)
-               for an in annots do project.min_api = an.arg_as_int(self)
+               if not annots.is_empty then
+                       var i = annots.pop.arg_as_int(self)
+                       if i == null then i = 0
+                       project.min_api = i
+                       for an in annots do
+                               i = an.arg_as_int(self)
+                               if i == null then continue
+                               project.min_api = project.min_api.max(i)
+                       end
+               end
 
                annots = collect_annotations_on_modules("max_api_version", mmodule)
-               for an in annots do project.max_api = an.arg_as_int(self)
+               if not annots.is_empty then
+                       var i = annots.pop.arg_as_int(self)
+                       if i == null then i = 0
+                       project.max_api = i
+                       for an in annots do
+                               i = an.arg_as_int(self)
+                               if i == null then continue
+                               project.max_api = project.max_api.min(i)
+                       end
+               end
 
-               annots = collect_annotations_on_modules("target_api_version", mmodule)
-               for an in annots do project.target_api = an.arg_as_int(self)
+               annot = lookup_annotation_on_modules("target_api_version", mmodule)
+               if annot != null then project.target_api = annot.arg_as_int(self) or else 0
 
                annots = collect_annotations_on_modules("android_manifest", mmodule)
                for an in annots do project.manifest_lines.add an.arg_as_string(self) or else ""