diff options
author | Lei Zhang <leizleiz@users.noreply.github.com> | 2016-09-01 00:13:10 -0700 |
---|---|---|
committer | Lei Zhang <leizleiz@users.noreply.github.com> | 2016-09-01 00:13:10 -0700 |
commit | 08652be8695a5e3732fa5c3d5d9c0a6d98b3b9e0 (patch) | |
tree | 75aed22a405542679b9089ba4a877e0d2263473c | |
parent | b18b09b6114b9b7fe6fc2f96d8b15e8a72f66916 (diff) | |
download | sfntly-08652be8695a5e3732fa5c3d5d9c0a6d98b3b9e0.tar.gz |
Add a nullptr check to GlyphTable::Glyph().
Do not attempt to create a new Glyph if there is no data.
Fixes https://crbug.com/641330
-rw-r--r-- | cpp/src/sfntly/table/truetype/glyph_table.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/cpp/src/sfntly/table/truetype/glyph_table.cc b/cpp/src/sfntly/table/truetype/glyph_table.cc index f38fac5..0c1e841 100644 --- a/cpp/src/sfntly/table/truetype/glyph_table.cc +++ b/cpp/src/sfntly/table/truetype/glyph_table.cc @@ -215,10 +215,11 @@ CALLER_ATTACH GlyphTable::Glyph* ReadableFontDataPtr sliced_data; sliced_data.Attach(down_cast<ReadableFontData*>(data->Slice(offset, length))); - if (type == GlyphType::kSimple) { - glyph = new SimpleGlyph(sliced_data); - } else { - glyph = new CompositeGlyph(sliced_data); + if (sliced_data) { + if (type == GlyphType::kSimple) + glyph = new SimpleGlyph(sliced_data); + else + glyph = new CompositeGlyph(sliced_data); } return glyph.Detach(); } |