From 18f76d68eae2d889296027ede3039502b645d7be Mon Sep 17 00:00:00 2001 From: scatterflower Date: Sat, 13 Mar 2021 03:17:46 -0600 Subject: [PATCH] fix crash from old music packets --- src/packets.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/packets.cpp b/src/packets.cpp index 421688f..9cc9989 100644 --- a/src/packets.cpp +++ b/src/packets.cpp @@ -210,9 +210,14 @@ void AOClient::pktChangeMusic(AreaData* area, int argc, QStringList argv, AOPack for (QString song : server->music_list) { if (song == argument || song == "~stop.mp3") { // ~stop.mp3 is a dummy track used by 2.9+ // We have a song here - AOPacket music_change("MC", {song, argv[1], argv[2], "1", "0", argv[3]}); + QString effects; + if (argc >= 4) + effects = argv[3]; + else + effects = "0"; + AOPacket music_change("MC", {song, argv[1], showname, "1", "0", effects}); area->current_music = song; - area->music_played_by = argv[2]; + area->music_played_by = showname; server->broadcast(music_change, current_area); return; }