summaryrefslogtreecommitdiff
path: root/core/fxcodec/codec
diff options
context:
space:
mode:
authorNicolas Pena <npm@chromium.org>2017-05-11 15:43:47 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-05-11 20:01:33 +0000
commit0dc8571d1354b8c319510be625a446218449f532 (patch)
treefec012e29cd98f7565565cdc84d219709c7e1dd6 /core/fxcodec/codec
parent830897a1774fb50d04b656d7bf70be321e133cf9 (diff)
downloadpdfium-0dc8571d1354b8c319510be625a446218449f532.tar.xz
Do not use vector data() when it is empty
Before, all pointers were being initialized to 0. After raw pointers were changed to vectors, data() was used in some cases, but now no longer returns nullptr when it is supposed to. This CL fixes that. Bug: chromium:721417 Change-Id: Ia31b75b18dc17d7eed48538145fe5d0d59668843 Reviewed-on: https://pdfium-review.googlesource.com/5353 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'core/fxcodec/codec')
-rw-r--r--core/fxcodec/codec/ccodec_gifmodule.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/fxcodec/codec/ccodec_gifmodule.cpp b/core/fxcodec/codec/ccodec_gifmodule.cpp
index 70f55ceaa8..983daa088f 100644
--- a/core/fxcodec/codec/ccodec_gifmodule.cpp
+++ b/core/fxcodec/codec/ccodec_gifmodule.cpp
@@ -54,7 +54,9 @@ GifDecodeStatus CCodec_GifModule::ReadHeader(FXGIF_Context* ctx,
*width = ctx->m_Gif->width;
*height = ctx->m_Gif->height;
*pal_num = ctx->m_Gif->global_pal_num;
- *pal_pp = ctx->m_Gif->m_GlobalPalette.data();
+ *pal_pp = ctx->m_Gif->m_GlobalPalette.empty()
+ ? nullptr
+ : ctx->m_Gif->m_GlobalPalette.data();
*bg_index = ctx->m_Gif->bc_index;
return GifDecodeStatus::Success;
}