summaryrefslogtreecommitdiff
path: root/bfd/bfdio.c
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/bfdio.c')
-rw-r--r--bfd/bfdio.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/bfd/bfdio.c b/bfd/bfdio.c
index 5ef3ec493ea..5f144bc7f3f 100644
--- a/bfd/bfdio.c
+++ b/bfd/bfdio.c
@@ -495,8 +495,9 @@ bfd_get_file_size (bfd *abfd)
struct areltdata *adata = (struct areltdata *) abfd->arelt_data;
archive_size = adata->parsed_size;
/* If the archive is compressed we can't compare against file size. */
- if (memcmp (((struct ar_hdr *) adata->arch_header)->ar_fmag,
- "Z\012", 2) == 0)
+ if (adata->arch_header != NULL
+ && memcmp (((struct ar_hdr *) adata->arch_header)->ar_fmag,
+ "Z\012", 2) == 0)
return archive_size;
abfd = abfd->my_archive;
}