summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarkus Mittendrein <git@maxmitti.tk>2020-03-29 22:50:05 +0200
committerMarkus Mittendrein <git@maxmitti.tk>2020-03-29 22:50:13 +0200
commit137a719fdd775374a16eb7f43f4cae2e68626b8a (patch)
tree982f8831b01c2c2f96cae1e0dacb22c82c4ec28b /src
parenta5ceb18e2b87c4547d78e17c832948f589ac35da (diff)
downloadcc4group-137a719fdd775374a16eb7f43f4cae2e68626b8a.tar.gz
cc4group-137a719fdd775374a16eb7f43f4cae2e68626b8a.zip
Fix lazy mode crashing when adding files and saving
Diffstat (limited to 'src')
-rw-r--r--src/cc4group.c11
1 files 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)
{