contrib/nitiwiki: avoid crash on `WikiArticle.md` with auto generated articles
authorAlexandre Terrasa <alexandre@moz-code.org>
Thu, 7 May 2015 05:35:09 +0000 (01:35 -0400)
committerAlexandre Terrasa <alexandre@moz-code.org>
Thu, 7 May 2015 14:03:53 +0000 (10:03 -0400)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

contrib/nitiwiki/src/wiki_base.nit

index dd1e2d6..dc019ed 100644 (file)
@@ -542,8 +542,8 @@ class WikiArticle
        # Extract the markdown text from `source_file`.
        #
        # REQUIRE: `has_source`.
-       var md: String is lazy do
-               assert has_source
+       var md: nullable String is lazy do
+               if not has_source then return null
                var file = new FileReader.open(src_full_path.to_s)
                var md = file.read_all
                file.close