Fix crash in zip_entry_size and zip_entry_crc32 (#54)

This commit is contained in:
Ivan Romanov 2018-08-16 20:55:07 +05:00 committed by Kuba Podgórski
parent 243948551e
commit fef7f11b89

View File

@ -524,11 +524,11 @@ int zip_entry_isdir(struct zip_t *zip) {
} }
unsigned long long zip_entry_size(struct zip_t *zip) { unsigned long long zip_entry_size(struct zip_t *zip) {
return zip->entry.uncomp_size; return zip ? zip->entry.uncomp_size : 0;
} }
unsigned int zip_entry_crc32(struct zip_t *zip) { unsigned int zip_entry_crc32(struct zip_t *zip) {
return zip->entry.uncomp_crc32; return zip ? zip->entry.uncomp_crc32 : 0;
} }
int zip_entry_write(struct zip_t *zip, const void *buf, size_t bufsize) { int zip_entry_write(struct zip_t *zip, const void *buf, size_t bufsize) {