Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Fix: prevent crash when stdoutRing or stderrRing is undefined #1321

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

decompi
Copy link

@decompi decompi commented Mar 25, 2025

This pull request fixes a bug that causes fluent-ffmpeg to crash when stdoutRing or stderrRing are undefined which happens when FFmpeg exits early or fails to spawn properly.

Problem:
In some rare cases (see #1316 ), the following error occurs:

TypeError: Cannot read properties of undefined (reading 'get')
    at emitEnd (.../lib/processor.js:543:37)

This indicates stdoutRing or stderrRing may have not been initialized in time

My Patch:

  • Adds a null-safe check using stdoutRing?.get?.() and fallback to null if undefined.
  • Logs a warning when either ring is unexpectedly missing

Changed Lines:

  • Line 470 (timeout handler)
  • Line 502(output stream err handler)
  • Line 550 (final endCB cleanup)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant