[subset] Fail subset if a table fails to sanitize.
diff --git a/src/hb-subset.cc b/src/hb-subset.cc index a9f599f..b7d3e37 100644 --- a/src/hb-subset.cc +++ b/src/hb-subset.cc
@@ -83,16 +83,19 @@ static bool _subset (hb_subset_plan_t *plan) { - OT::Sanitizer<TableType> sanitizer; - hb_blob_t *source_blob = sanitizer.sanitize (plan->source->reference_table (TableType::tableTag)); - const TableType *table = OT::Sanitizer<TableType>::lock_instance (source_blob); - hb_bool_t result = table->subset(plan); + OT::Sanitizer<TableType> sanitizer; - hb_blob_destroy (source_blob); + hb_blob_t *source_blob = sanitizer.sanitize (plan->source->reference_table (TableType::tableTag)); + const TableType *table = OT::Sanitizer<TableType>::lock_instance (source_blob); - hb_tag_t tag = TableType::tableTag; - DEBUG_MSG(SUBSET, nullptr, "OT::%c%c%c%c::subset %s", HB_UNTAG(tag), result ? "success" : "FAILED!"); - return result; + hb_bool_t result = false; + if (table != &OT::Null(TableType)) + result = table->subset(plan); + + hb_blob_destroy (source_blob); + hb_tag_t tag = TableType::tableTag; + DEBUG_MSG(SUBSET, nullptr, "OT::%c%c%c%c::subset %s", HB_UNTAG(tag), result ? "success" : "FAILED!"); + return result; }