diff --git a/SUBinaryDeltaCommon.m b/SUBinaryDeltaCommon.m index e4f9ed6f..43e31912 100644 --- a/SUBinaryDeltaCommon.m +++ b/SUBinaryDeltaCommon.m @@ -78,6 +78,11 @@ static void _hashOfFile(unsigned char* hash, FTSENT *ent) } size_t fileSize = (size_t)ent->fts_statp->st_size; + if (fileSize == 0) { + _hashOfBuffer(hash, NULL, 0); + return; + } + void *buffer = mmap(0, fileSize, PROT_READ, MAP_FILE | MAP_PRIVATE, fileDescriptor, 0); if (buffer == (void*)-1) { close(fileDescriptor);