Avoid deferencing null pointer when calling GetFirstMatchingFont
The call to GetFirstMatchingFont(...) may fail. The matched_font will be unset and can be null. As stated on the doc: https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontfamily-getfirstmatchingfont The return value may be fail. Type: HRESULT If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. StackFrame: content::FontFallback::GetCachedFont(std::__1::basic_string<wchar_t,std::__1::char_traits<wchar_t>,std::__1::allocator<wchar_t> > const &,wchar_t const *,wchar_t const *,DWRITE_FONT_WEIGHT,DWRITE_FONT_STYLE,DWRITE_FONT_STRETCH,IDWriteFont * *,unsigned int *) content::FontFallback::MapCharacters(IDWriteTextAnalysisSource *,unsigned int,unsigned int,IDWriteFontCollection *,wchar_t const *,DWRITE_FONT_WEIGHT,DWRITE_FONT_STYLE,DWRITE_FONT_STRETCH,unsigned int *,IDWriteFont * *,float *) SkFontMgr_DirectWrite::fallback(wchar_t const *,DWriteStyle,wchar_t const *,unsigned int) SkFontMgr_DirectWrite::onMatchFamilyStyleCharacter(char const * const,SkFontStyle const &,char const * * const,int,int) blink::FontCache::GetDWriteFallbackFamily(blink::FontDescription const &,int,blink::FontFallbackPriority) blink::FontCache::PlatformFallbackFontForCharacter(blink::FontDescription const &,int,blink::SimpleFontData const *,blink::FontFallbackPriority) blink::FontCache::FallbackFontForCharacter(blink::FontDescription const &,int,blink::S R=drott@chromium.org, fdoray@chromium.org CC=eae@chromium.org Bug: 997081 Change-Id: I3c007f3a7d9bba5dba78ae1a5e1eaaa7f8e8a7e4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1814703Reviewed-by:Dominik Röttsches <drott@chromium.org> Commit-Queue: Etienne Bergeron <etienneb@chromium.org> Cr-Commit-Position: refs/heads/master@{#698400}
Showing
Please register or sign in to comment