From 531606a32ac07fde3dcaf96b6d523d56f6df417d Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Sun, 22 Dec 2024 17:24:48 +0200 Subject: [PATCH] Return empty bytes for empty blob --- src/uharfbuzz/_harfbuzz.pyx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/uharfbuzz/_harfbuzz.pyx b/src/uharfbuzz/_harfbuzz.pyx index 559f503..113f081 100644 --- a/src/uharfbuzz/_harfbuzz.pyx +++ b/src/uharfbuzz/_harfbuzz.pyx @@ -421,6 +421,8 @@ cdef class Blob: @property def data(self) -> bytes: """Return the blob's data as bytes.""" + if not self: + return b"" cdef unsigned int blob_length cdef const_char* blob_data = hb_blob_get_data(self._hb_blob, &blob_length) return blob_data[:blob_length]