URI: 
       Fix null pointer access for submodules in writefilestree - stagit-gopher - A git gopher frontend. (mirror)
  HTML git clone git://bitreich.org/stagit-gopher/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/stagit-gopher/
   DIR Log
   DIR Files
   DIR Refs
   DIR Tags
   DIR README
   DIR LICENSE
       ---
   DIR commit b8af751b0108edcad02bc59cec496b1d7808b0e1
   DIR parent 375d41dcce94106460f1b3855ebb295ccb138593
  HTML Author: Quentin Rameau <quinq@fifth.space>
       Date:   Fri, 29 Apr 2016 14:01:45 +0200
       
       Fix null pointer access for submodules in writefilestree
       
       Do not try to set a link to submodules from bare repo as we can't get
       the actual url.
       
       Diffstat:
         M stagit.c                            |      17 +++++++++++------
       
       1 file changed, 11 insertions(+), 6 deletions(-)
       ---
   DIR diff --git a/stagit.c b/stagit.c
       @@ -709,13 +709,18 @@ writefilestree(FILE *fp, git_tree *tree, const char *branch, const char *path)
                                        fprintf(fp, "%juB", (uintmax_t)filesize);
                                fputs("</td></tr>\n", fp);
                        } else if (git_submodule_lookup(&module, repo, entryname) == 0) {
       -                        moduleurl = git_submodule_url(module);
       -                        fprintf(fp, "<tr><td>m---------</td><td><a class=\"module\" href=\"%s\">",
       -                                moduleurl);
       +                        fputs("<tr><td>m---------</td><td>", fp);
       +                        if ((moduleurl = git_submodule_url(module))) {
       +                                fprintf(fp, "<a class=\"module\" href=\"%s\">",
       +                                        moduleurl);
       +                        }
                                xmlencode(fp, entrypath, strlen(entrypath));
       -                        fputs(" @", fp);
       -                        xmlencode(fp, moduleurl, strlen(moduleurl));
       -                        fprintf(fp, "</a></td><td class=\"num\">0%c",
       +                        if (moduleurl) {
       +                                fputs(" @", fp);
       +                                xmlencode(fp, moduleurl, strlen(moduleurl));
       +                                fputs("</a>", fp);
       +                        }
       +                        fprintf(fp, "</td><td class=\"num\">0%c",
                                        showlinecount ? 'L' : 'B');
                                git_submodule_free(module);
                                fputs("</td></tr>\n", fp);