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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user