From 6e6d3d11675a4ec1c991320b2ce363ded12888c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Tom=C3=A1s?= Date: Fri, 1 Jul 2022 11:00:44 -0300 Subject: [PATCH] fixed sound bug --- src/Sound.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Sound.cpp b/src/Sound.cpp index 0e85f4b..80ec0a3 100644 --- a/src/Sound.cpp +++ b/src/Sound.cpp @@ -42,7 +42,8 @@ Sound::~Sound() { if (chunk != nullptr) { - Mix_HaltChannel(channel); + if (channel >= -1) + Mix_HaltChannel(channel); Mix_FreeChunk(chunk); cout << "Sound deleted successfully!" << endl; }