summaryrefslogtreecommitdiffabout
path: root/ui-summary.c
authorLars Hjemli <hjemli@gmail.com>2007-10-28 14:36:18 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2007-10-28 14:38:19 (UTC)
commitcbcdbcf2bff23113fe81df8f11fe7843b8ed637e (patch) (unidiff)
tree1c434e9005aa946daa8f7aa49a9c9f3656349068 /ui-summary.c
parent68ca032dbe7379f78775fb03ef34a9ad2abc409f (diff)
downloadcgit-cbcdbcf2bff23113fe81df8f11fe7843b8ed637e.zip
cgit-cbcdbcf2bff23113fe81df8f11fe7843b8ed637e.tar.gz
cgit-cbcdbcf2bff23113fe81df8f11fe7843b8ed637e.tar.bz2
Make print_branch() handle refs not pointing at commits
The master branch of stable/linux-2.6.20 currently references a tag object, which makes print_branch() die with a segfault. This teaches print_branch() to handle such cases more gracefully. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'ui-summary.c') (more/less context) (ignore whitespace changes)
-rw-r--r--ui-summary.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/ui-summary.c b/ui-summary.c
index 04a466a..ba90510 100644
--- a/ui-summary.c
+++ b/ui-summary.c
@@ -53,21 +53,27 @@ static int print_branch(struct refinfo *ref)
53 struct commitinfo *info = ref->commit; 53 struct commitinfo *info = ref->commit;
54 char *name = (char *)ref->refname; 54 char *name = (char *)ref->refname;
55 55
56 if (!info) 56 if (!info)
57 return 1; 57 return 1;
58 html("<tr><td>"); 58 html("<tr><td>");
59 cgit_log_link(name, NULL, NULL, name, NULL, NULL, 0); 59 cgit_log_link(name, NULL, NULL, name, NULL, NULL, 0);
60 html("</td><td>"); 60 html("</td><td>");
61 cgit_print_age(info->commit->date, -1, NULL); 61
62 html("</td><td>"); 62 if (ref->object->type == OBJ_COMMIT) {
63 html_txt(info->author); 63 cgit_print_age(info->commit->date, -1, NULL);
64 html("</td><td>"); 64 html("</td><td>");
65 cgit_commit_link(info->subject, NULL, NULL, name, NULL); 65 html_txt(info->author);
66 html("</td><td>");
67 cgit_commit_link(info->subject, NULL, NULL, name, NULL);
68 } else {
69 html("</td><td></td><td>");
70 cgit_object_link(ref->object);
71 }
66 html("</td></tr>\n"); 72 html("</td></tr>\n");
67 return 0; 73 return 0;
68} 74}
69 75
70static void print_tag_header() 76static void print_tag_header()
71{ 77{
72 html("<tr class='nohover'><th class='left'>Tag</th>" 78 html("<tr class='nohover'><th class='left'>Tag</th>"
73 "<th class='left'>Age</th>" 79 "<th class='left'>Age</th>"