DATARAMA

Fix crash bug when handling deleted pages

May 02, 2016
Project: plutonium

The deleted page handler regenerates dependencies to deactivate links — but didn't check if reverse dependencies exist before doing so, causing a crash if one didn't. This is now fixed.

1 files changed, 5 insertions / 3 deletions

diff --git a/plutonium.scm b/plutonium.scm
index 2378c95..aec410a 100755
--- a/plutonium.scm
+++ b/plutonium.scm
@@ -435,7 +435,9 @@
     `(div (@ (id "project-info"))
        (h1 "Download")
        (ul  (@ (class "download"))
-         ,(goon-tag-link (car (goon-tags manifest)))
+            ,(if (not (null? (goon-tags manifest)))
+               (goon-tag-link (car (goon-tags manifest)))
+               "")
          (li (span (@ (class "desc")) "Development") 
              (span (@ (class "link")) ,(filepath:combine goon-clone-prefix ELEMENT))))
         (h1 "Latest Activity")
@@ -473,7 +475,7 @@
     (if (not (null? ELEMENT))
       `(div (@ (id "rels"))
          (h2 "See Also")
-           `(ul ,(map rel->link ELEMENT)))
+           (ul ,(map rel->link ELEMENT)))
       '())))
 
 (define (focuslink lnk)
@@ -523,7 +525,7 @@
               (let ((path (filepath:combine 
                             input-dir 
                             (string-append y "." extension))))
-                (if (not (member y entries)) 
+                (if (and (not (member y entries)) (file-exists? path))
                   (output-page (generate-page path) 
                                (output-path path output-dir)))))
             (cdr rassocs)))))
 
Powered by Plutonium