summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/zip/lib/zip_get_archive_comment.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/ext/zip/lib/zip_get_archive_comment.c b/ext/zip/lib/zip_get_archive_comment.c
index 6e68f2f4d9..7844c5e191 100644
--- a/ext/zip/lib/zip_get_archive_comment.c
+++ b/ext/zip/lib/zip_get_archive_comment.c
@@ -45,9 +45,11 @@ zip_get_archive_comment(struct zip *za, int *lenp, int flags)
{
if ((flags & ZIP_FL_UNCHANGED)
|| (za->ch_comment_len == -1)) {
- if (lenp != NULL)
- *lenp = za->cdir->comment_len;
- return za->cdir->comment;
+ if (za->cdir) {
+ if (lenp != NULL)
+ *lenp = za->cdir->comment_len;
+ return za->cdir->comment;
+ }
}
if (lenp != NULL)