Skip to content

Commit

Permalink
dispatch_data_t parameter to handle is NULL on successful write
Browse files Browse the repository at this point in the history
  • Loading branch information
oluseyi committed Apr 4, 2020
1 parent 702b7a9 commit c8c8754
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Psd/PsdNativeFile_Mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,14 @@
operation->dataToWrite = dispatch_data_create(buffer, count, queue, DISPATCH_DATA_DESTRUCTOR_DEFAULT);
operation->ioHandler = ^(dispatch_data_t d, int error)
{
if (error != 0 )
if (d != NULL || error != 0 )
{
PSD_ERROR("NativeFile", "Cannot read %u bytes from file position %" PRIu64 " asynchronously.", count, position);
PSD_ERROR("NativeFile", "Cannot write %u bytes to file position %" PRIu64 " asynchronously.", count, position);
}
else
{
operation->bytesWritten = operation->length;
}
operation->bytesWritten = dispatch_data_get_size(d);
dispatch_semaphore_signal(operation->semaphore);
};
return static_cast<File::ReadOperation>(operation);
Expand Down

0 comments on commit c8c8754

Please sign in to comment.