Skip to content

Commit

Permalink
Fix a crash I'm getting in After Effects
Browse files Browse the repository at this point in the history
  • Loading branch information
fnordware committed Aug 8, 2014
1 parent cb03ee0 commit 4dc89c9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
12 changes: 5 additions & 7 deletions src/photoshop/SuperPNG_Input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ static void ReadMetadataPre(GPtr globals, png_structp png_ptr, png_infop info_pt

static void ReadMetadataPost(GPtr globals, png_structp png_ptr, png_infop info_ptr)
{
if(gStuff->propertyProcs)
if(gStuff->propertyProcs && gStuff->propertyProcs->numPropertyProcs >= 2)
{
png_textp text_blocks = NULL;
int num_blocks = 0;
Expand Down Expand Up @@ -744,12 +744,10 @@ void SuperPNG_FileInfo(GPtr globals)
gStuff->transparencyPlane = gStuff->planes - 1;
gStuff->transparencyMatting = 0;
}

if(gStuff->hostSig != 'FXTC')
{
ReadMetadataPre(globals, png_ptr, info_ptr);
ReadMetadataPost(globals, png_ptr, info_ptr);
}


ReadMetadataPre(globals, png_ptr, info_ptr);
ReadMetadataPost(globals, png_ptr, info_ptr);


png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
Expand Down
6 changes: 3 additions & 3 deletions src/photoshop/SuperPNG_Output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ static void WriteMetadata(GPtr globals, png_structp png_ptr, png_infop info_ptr)
png_set_tIME(png_ptr, info_ptr, &pngTime);


if( (gStuff->hostSig != 'FXTC') && gStuff->imageHRes )
if( (gStuff->hostSig != 'FXTC') && (gStuff->imageHRes > 0) )
{
// pixels per inch
const double dpi_x = (double)gStuff->imageHRes / 65536.0;
Expand All @@ -285,7 +285,7 @@ static void WriteMetadata(GPtr globals, png_structp png_ptr, png_infop info_ptr)


// Write ICC Profile - this will only happen if the user checks the box in Save As
if( gStuff->canUseICCProfiles && (gStuff->iCCprofileSize > 0) && (gStuff->iCCprofileData != NULL) )
if(gStuff->canUseICCProfiles && (gStuff->iCCprofileSize > 0) && (gStuff->iCCprofileData != NULL) )
{
const Ptr icc = myLockHandle(globals, gStuff->iCCprofileData);

Expand Down Expand Up @@ -399,7 +399,7 @@ static void WriteMetadata(GPtr globals, png_structp png_ptr, png_infop info_ptr)
}
}

if(gStuff->propertyProcs)
if(gStuff->propertyProcs && gStuff->propertyProcs->numPropertyProcs >= 1)
{
int32 handleSize[6] = {0,0,0,0,0,0}; // Max of 6 items for now
intptr_t simpleProperty[6] = {0,0,0,0,0,0};
Expand Down
2 changes: 1 addition & 1 deletion src/photoshop/SuperPNG_Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#define SuperPNG_Minor_Version 5
#define SuperPNG_Version_String "2.5"
#define SuperPNG_Build_Date __DATE__
#define SuperPNG_Build_Date_Manual "25 June 2014"
#define SuperPNG_Build_Date_Manual "7 August 2014"
#define SuperPNG_Build_Complete_Manual "v2.5 - " SuperPNG_Build_Date
#define SuperPNG_Copyright_Year "2002-2014"
#define SuperPNG_Build_Year "2014"
Expand Down

0 comments on commit 4dc89c9

Please sign in to comment.