diff options
author | bungeman <bungeman@google.com> | 2014-09-12 12:14:14 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-12 12:14:14 -0700 |
commit | 9db509272a6fa2badbbdd2f5afce827370960a5f (patch) | |
tree | 67ae22581b943293321b6f2d6fcfa95930a9ccc0 | |
parent | 9594da111dc1c36c1912eb61207aaa54c17ea550 (diff) |
Handle NULL typeface in SkFontMgr_fontconfig::onMatchFaceStyle.
SampleApp does this, and it needs to be handled properly.
R=mtklein@google.com
Author: bungeman@google.com
Review URL: https://codereview.chromium.org/563263003
-rw-r--r-- | src/ports/SkFontMgr_fontconfig.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/ports/SkFontMgr_fontconfig.cpp b/src/ports/SkFontMgr_fontconfig.cpp index 782fb268cc..b8a3fe5b0d 100644 --- a/src/ports/SkFontMgr_fontconfig.cpp +++ b/src/ports/SkFontMgr_fontconfig.cpp @@ -798,9 +798,13 @@ protected: const SkFontStyle& style) const SK_OVERRIDE { //TODO: should the SkTypeface_fontconfig know its family? - const SkTypeface_fontconfig* fcTypeface = - static_cast<const SkTypeface_fontconfig*>(typeface); - return this->matchFamilyStyle(get_string(fcTypeface->fPattern, FC_FAMILY), style); + const char* name = NULL; + if (typeface) { + const SkTypeface_fontconfig* fcTypeface = + static_cast<const SkTypeface_fontconfig*>(typeface); + name = get_string(fcTypeface->fPattern, FC_FAMILY); + } + return this->matchFamilyStyle(name, style); } /** @param stream does not take ownership of the reference. */ |