fix: prevent UnboundLocalError when large recordings are skipped

Fixed a crash that occurred when recordings >100MB were encountered.
The store_recording_in_media function was attempting to return file_name
outside the scope where it was defined, causing an UnboundLocalError when
get_recorded_file returned None for oversized recordings.

This fix moves the return statement inside the if recording: block and
adds an explicit return None for the case when recording is skipped.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
pull/106/head
Jeff Culverhouse 2 weeks ago
parent 6d0a0d007d
commit 5973fe2444

@ -290,7 +290,9 @@ class HelpersMixin:
self.logger.error(f"failed to save symlink {latest_link} -> {local_file}: {err!r}")
pass
return file_name
return file_name
return None
async def cleanup_old_recordings(self: Amcrest2Mqtt) -> None:
media_path = self.config["media"].get("path")

Loading…
Cancel
Save