Fix null pointer crash in looking up nonexistent typeface

Bug: chromium:939762
Change-Id: Id9f6ae3c4965069d1ee585f405036e6fe6226c12
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/200600
Auto-Submit: Adrienne Walker <enne@chromium.org>
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
This commit is contained in:
Adrienne Walker 2019-03-12 14:44:58 -07:00 committed by Skia Commit-Bot
parent d006b54ed8
commit dc087c60f6

View File

@ -716,9 +716,10 @@ bool SkStrikeClient::readStrikeData(const volatile void* memory, size_t memorySi
if (!deserializer.read<SkFontMetrics>(&fontMetrics)) READ_FAILURE
// Get the local typeface from remote fontID.
auto* tf = fRemoteFontIdToTypeface.find(spec.typefaceID)->get();
auto* tfPtr = fRemoteFontIdToTypeface.find(spec.typefaceID);
// Received strikes for a typeface which doesn't exist.
if (!tf) READ_FAILURE
if (!tfPtr) READ_FAILURE
auto* tf = tfPtr->get();
// Replace the ContextRec in the desc from the server to create the client
// side descriptor.