index: do not segfault if there are no description

cute-signatures
Natanael Copa 2009-09-03 13:15:10 +00:00
parent 58e771303c
commit 330dc5511a
1 changed files with 7 additions and 5 deletions

View File

@ -173,11 +173,13 @@ static int index_main(void *ctx, struct apk_database *db, int argc, char **argv)
os = apk_ostream_gzip(os);
memset(&fi, 0, sizeof(fi));
fi.mode = 0644 | S_IFREG;
fi.name = "DESCRIPTION";
fi.size = strlen(ictx->description);
apk_tar_write_entry(os, &fi, ictx->description);
if (ictx->description != NULL) {
memset(&fi, 0, sizeof(fi));
fi.mode = 0644 | S_IFREG;
fi.name = "DESCRIPTION";
fi.size = strlen(ictx->description);
apk_tar_write_entry(os, &fi, ictx->description);
}
memset(&fi, 0, sizeof(fi));
fi.mode = 0644 | S_IFREG;