diff --git a/src/hb-subset-input.cc b/src/hb-subset-input.cc index 05d70ffa7..5165a7904 100644 --- a/src/hb-subset-input.cc +++ b/src/hb-subset-input.cc @@ -464,6 +464,8 @@ HB_EXTERN hb_face_t * hb_subset_preprocess (hb_face_t *source) { hb_subset_input_t* input = hb_subset_input_create_or_fail (); + if (!input) + return source; hb_set_clear (hb_subset_input_set(input, HB_SUBSET_SETS_UNICODE)); hb_set_invert (hb_subset_input_set(input, HB_SUBSET_SETS_UNICODE)); @@ -505,6 +507,11 @@ hb_subset_preprocess (hb_face_t *source) hb_face_t* new_source = hb_subset_or_fail (source, input); hb_subset_input_destroy (input); + if (!new_source) { + DEBUG_MSG (SUBSET, nullptr, "Preprocessing failed due to subset failure."); + return source; + } + return new_source; } #endif