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

@ -292,6 +292,8 @@ class HelpersMixin:
return file_name
return None
async def cleanup_old_recordings(self: Amcrest2Mqtt) -> None:
media_path = self.config["media"].get("path")
retention_days = self.config["media"].get("retention_days", 7)

Loading…
Cancel
Save