Browse Source

fix: handle null return values from media save functions

Convert null to undefined when assigning to optional ref fields
to satisfy TypeScript type constraints.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
handoff-20260429-1057
Shrimbly 4 months ago
committed by shrimbly
parent
commit
6933402028
  1. 8
      src/utils/mediaStorage.ts

8
src/utils/mediaStorage.ts

@ -158,7 +158,7 @@ async function externalizeNodeMedia(
newData = { ...d, audioFile: null };
} else if (isDataUrl(d.audioFile)) {
const audioRef = await saveAudioAndGetRef(d.audioFile, workflowPath, savedMediaIds);
newData = { ...d, audioFile: null, audioFileRef: audioRef };
newData = { ...d, audioFile: null, audioFileRef: audioRef || undefined };
} else {
newData = d;
}
@ -314,7 +314,8 @@ async function externalizeNodeMedia(
} else if (isDataUrl(d.outputVideo)) {
const selectedIndex = d.selectedVideoHistoryIndex || 0;
const expectedRef = d.videoHistory?.[selectedIndex]?.id;
outputVideoRef = await saveVideoAndGetRef(d.outputVideo, workflowPath, savedMediaIds, expectedRef);
const videoRef = await saveVideoAndGetRef(d.outputVideo, workflowPath, savedMediaIds, expectedRef);
outputVideoRef = videoRef || undefined;
outputVideo = null;
}
}
@ -374,7 +375,8 @@ async function externalizeNodeMedia(
} else if (isDataUrl(d.outputAudio)) {
const selectedIndex = d.selectedAudioHistoryIndex || 0;
const expectedRef = d.audioHistory?.[selectedIndex]?.id;
outputAudioRef = await saveAudioAndGetRef(d.outputAudio, workflowPath, savedMediaIds, expectedRef);
const audioRef = await saveAudioAndGetRef(d.outputAudio, workflowPath, savedMediaIds, expectedRef);
outputAudioRef = audioRef || undefined;
outputAudio = null;
}
}

Loading…
Cancel
Save