fix NULL dereference if a template has no blocks + tiny style fix - saait - the most boring static page generator
 (HTM) git clone git://git.codemadness.org/saait
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 66bae484ec19ebad289b59b9250cfb726899cda5
 (DIR) parent 48eaa7dac60dfd491fdb1e915f59741cf1a19dd0
 (HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
       Date:   Sun,  5 Apr 2020 12:59:52 +0200
       
       fix NULL dereference if a template has no blocks + tiny style fix
       
       Diffstat:
         M saait.c                             |       7 ++++---
       
       1 file changed, 4 insertions(+), 3 deletions(-)
       ---
 (DIR) diff --git a/saait.c b/saait.c
       @@ -483,8 +483,8 @@ main(int argc, char *argv[])
                                                path, ir->d_name);
                                        exit(1);
                                }
       -                        b->data = readfile(file);
                                b->name = estrdup(file);
       +                        b->data = readfile(file);
                        }
                        closedir(idir);
                }
       @@ -564,8 +564,9 @@ main(int argc, char *argv[])
                                        fclose(templates[j].fp);
                                } else {
                                        b = &templates[j].blocks[BlockItem];
       -                                writepage(templates[j].fp, b->name, argv[i], c,
       -                                          b->data);
       +                                if (b->name)
       +                                        writepage(templates[j].fp, b->name,
       +                                                  argv[i], c, b->data);
                                }
                        }
                        freevars(c);