Skip to content

Commit

Permalink
Return empty bytes for empty blob
Browse files Browse the repository at this point in the history
  • Loading branch information
khaledhosny committed Dec 22, 2024
1 parent 2c9c0be commit 531606a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/uharfbuzz/_harfbuzz.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 531606a

Please sign in to comment.