From ed4acbde9c5e3323cc95037b500d1bf2878ed3ee Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 16 Aug 2010 14:36:27 -0400 Subject: [PATCH] Fix NULL dereference Reported by Jonathan Kew. Face table handling needs to be redone anyway, but fix this for now. --- src/hb-ot-layout.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 31451fc40..965a2fb79 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -76,19 +76,19 @@ _hb_ot_layout_free (hb_ot_layout_t *layout) static const GDEF& _get_gdef (hb_face_t *face) { - return likely (face->ot_layout->gdef) ? *face->ot_layout->gdef : Null(GDEF); + return likely (face->ot_layout && face->ot_layout->gdef) ? *face->ot_layout->gdef : Null(GDEF); } static const GSUB& _get_gsub (hb_face_t *face) { - return likely (face->ot_layout->gsub) ? *face->ot_layout->gsub : Null(GSUB); + return likely (face->ot_layout && face->ot_layout->gsub) ? *face->ot_layout->gsub : Null(GSUB); } static const GPOS& _get_gpos (hb_face_t *face) { - return likely (face->ot_layout->gpos) ? *face->ot_layout->gpos : Null(GPOS); + return likely (face->ot_layout && face->ot_layout->gpos) ? *face->ot_layout->gpos : Null(GPOS); }