From 137a719fdd775374a16eb7f43f4cae2e68626b8a Mon Sep 17 00:00:00 2001 From: Markus Mittendrein Date: Sun, 29 Mar 2020 22:50:05 +0200 Subject: Fix lazy mode crashing when adding files and saving --- src/cc4group.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/cc4group.c b/src/cc4group.c index b086110..f07cdeb 100644 --- a/src/cc4group.c +++ b/src/cc4group.c @@ -2056,12 +2056,15 @@ static const uint8_t* cc4group_getOnlyEntryData(CC4Group* const this, const C4Gr { if(this->lazy) { - if(!cc4group_uncompressUntilPosition(this, entry->absolutePosition + entry->core.Size)) + if(!entry->data && entry->core.Size > 0) { - return NULL; - } + if(!cc4group_uncompressUntilPosition(this, entry->absolutePosition + entry->core.Size)) + { + return NULL; + } - ((C4GroupEntryData*)entry)->data = this->uncompressedData + entry->absolutePosition; + ((C4GroupEntryData*)entry)->data = this->uncompressedData + entry->absolutePosition; + } } else if(entry->path != NULL && entry->data == NULL) { -- cgit v1.2.3-54-g00ecf