diff options
Diffstat (limited to 'framesequence/jni/FrameSequence_gif.cpp')
-rw-r--r-- | framesequence/jni/FrameSequence_gif.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/framesequence/jni/FrameSequence_gif.cpp b/framesequence/jni/FrameSequence_gif.cpp index 8f59dba..8d6a43b 100644 --- a/framesequence/jni/FrameSequence_gif.cpp +++ b/framesequence/jni/FrameSequence_gif.cpp @@ -120,12 +120,14 @@ FrameSequence_gif::FrameSequence_gif(Stream* stream) : } #endif - if (mGif->SColorMap) { + const ColorMapObject* cmap = mGif->SColorMap; + if (cmap) { // calculate bg color GraphicsControlBlock gcb; DGifSavedExtensionToGCB(mGif, 0, &gcb); - if (gcb.TransparentColor == NO_TRANSPARENT_COLOR) { - mBgColor = gifColorToColor8888(mGif->SColorMap->Colors[mGif->SBackGroundColor]); + if (gcb.TransparentColor == NO_TRANSPARENT_COLOR + && mGif->SBackGroundColor < cmap->ColorCount) { + mBgColor = gifColorToColor8888(cmap->Colors[mGif->SBackGroundColor]); } } } @@ -367,4 +369,3 @@ static RegistryEntry gEntry = { acceptsBuffers, }; static Registry gRegister(gEntry); - |