struct heif_error
{
...
// textual error message (is always defined, you do not have to check for NULL)
const char* message;
};
And heif_context_write only check if writer_error.message exists:
if (!writer_error.message) {
return heif_error{heif_error_Usage_error, heif_suberror_Null_pointer_argument, "heif_writer callback returned a null error text"};
}
As mentioned in the comment: https://github.com/strukturag/libheif/blob/master/libheif/heif.h#L321-L322
And
heif_context_write
only check ifwriter_error.message
exists:https://github.com/strukturag/libheif/blob/master/libheif/heif.cc#L1953-L1955