Fix undefined playlist variable in receive_edited_media endpoint

- Initialize playlist variable to None to prevent UnboundLocalError
- Fixes crash when player has no assigned playlist
- Ensures graceful handling of all playlist assignment scenarios
This commit is contained in:
Deployment System
2026-01-17 21:50:27 +02:00
parent 9c0a45afab
commit 8a89df3486

View File

@@ -827,6 +827,7 @@ def receive_edited_media():
db.session.add(edit_record)
# Update playlist version to force player refresh
playlist = None
if player.playlist_id:
from app.models.playlist import Playlist
playlist = db.session.get(Playlist, player.playlist_id)
@@ -847,7 +848,7 @@ def receive_edited_media():
'version': version,
'old_filename': old_filename,
'new_filename': new_filename,
'new_playlist_version': playlist.version if player.playlist_id and playlist else None
'new_playlist_version': playlist.version if playlist else None
}), 200
except Exception as e: