From 88bb746b42ca4ae67e5e25cb669b604170d349c6 Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Fri, 1 Apr 2022 02:18:37 +0200 Subject: [PATCH] [blob] Return nullptr from create_from_file_or_fail Fix a couple of cases where it would return empty blob, possibly missed in bdfed8f113431a2156e13d59a4b21e19feb7efd9. --- src/hb-blob.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hb-blob.cc b/src/hb-blob.cc index f120002d1..65e44c7f6 100644 --- a/src/hb-blob.cc +++ b/src/hb-blob.cc @@ -631,7 +631,7 @@ hb_blob_create_from_file_or_fail (const char *file_name) Allison Lortie permission but changed a lot to suit our need. */ #if defined(HAVE_MMAP) && !defined(HB_NO_MMAP) hb_mapped_file_t *file = (hb_mapped_file_t *) hb_calloc (1, sizeof (hb_mapped_file_t)); - if (unlikely (!file)) return hb_blob_get_empty (); + if (unlikely (!file)) return nullptr; int fd = open (file_name, O_RDONLY | O_BINARY, 0); if (unlikely (fd == -1)) goto fail_without_close; @@ -671,7 +671,7 @@ fail_without_close: #elif defined(_WIN32) && !defined(HB_NO_MMAP) hb_mapped_file_t *file = (hb_mapped_file_t *) hb_calloc (1, sizeof (hb_mapped_file_t)); - if (unlikely (!file)) return hb_blob_get_empty (); + if (unlikely (!file)) return nullptr; HANDLE fd; unsigned int size = strlen (file_name) + 1;