From 91f287087f6bfa447dd9e420f3071a362602b54b Mon Sep 17 00:00:00 2001 From: Ben Date: Fri, 12 Jun 2020 15:23:11 +0100 Subject: [PATCH] Check track has been found before trying to access its attributes --- houdini/handlers/play/music.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/houdini/handlers/play/music.py b/houdini/handlers/play/music.py index e015907..f140bfa 100644 --- a/houdini/handlers/play/music.py +++ b/houdini/handlers/play/music.py @@ -197,9 +197,10 @@ async def handle_get_shared_music_tracks(p): @handlers.player_in_room(SoundStudio.StudioRoomId, SoundStudio.DeckRoomId) async def handle_load_music_track(p, owner_id: int, track_id: int): track = await get_track(owner_id, track_id) - encoded_track_pattern = encode_music_track(track.pattern) - await p.send_xt('loadmusictrack', track.id, track.name, int(track.sharing), track.pattern, - encoded_track_pattern, track.likes) + if track is not None: + encoded_track_pattern = encode_music_track(track.pattern) + await p.send_xt('loadmusictrack', track.id, track.name, int(track.sharing), track.pattern, + encoded_track_pattern, track.likes) @handlers.handler(XTPacket('musictrack', 'savemymusictrack'), client=ClientType.Vanilla)