Skip to content

Commit e79b0b5

Browse files
committed
Disabled transferable check for return value if the message port does not support transferables
1 parent 98fbd91 commit e79b0b5

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

SpawnDev.BlazorJS.WebWorkers/ServiceCallDispatcher.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,8 @@ async Task HandleCallMessage(Type serviceType, Array args, bool noReply, bool ke
392392
{
393393
// Send notification of completion because there is a requestId
394394
var transferableList = new List<object>();
395-
if (retValue != null)
395+
// only check for transferables if transferables are supported and the return value is not null
396+
if (retValue != null && _port != null)
396397
{
397398
if (retValue is byte[] bytes)
398399
{
@@ -682,6 +683,7 @@ static bool IsAction(Type type)
682683
var transferableListAttributeFound = transferableListAttributeParameter != null;
683684
var argsLength = args == null ? 0 : args.Length;
684685
object?[]? ret = new object?[argsLength];
686+
var postSupportsTransferables = _port != null;
685687
for (var i = 0; i < argsLength; i++)
686688
{
687689
var arg = args![i];

0 commit comments

Comments
 (0)