From 0dc8571d1354b8c319510be625a446218449f532 Mon Sep 17 00:00:00 2001 From: Nicolas Pena Date: Thu, 11 May 2017 15:43:47 -0400 Subject: Do not use vector data() when it is empty MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Commit-Queue: Nicolás Peña --- core/fxcodec/codec/ccodec_gifmodule.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'core/fxcodec/codec/ccodec_gifmodule.cpp') 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; } -- cgit v1.2.3