From fe60afda0ec8e9ab86b66de6bf3a238e61f0a187 Mon Sep 17 00:00:00 2001 From: Bart van Strien Date: Mon, 6 Sep 2010 07:53:30 +0200 Subject: [PATCH] Moved volume change in modplug decoder to after check if file has been loaded, thanks Michael R (fixes #60) --- changes.txt | 1 + src/modules/sound/lullaby/ModPlugDecoder.cpp | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/changes.txt b/changes.txt index 73379f7df..f4cb6210a 100644 --- a/changes.txt +++ b/changes.txt @@ -33,6 +33,7 @@ LOVE 0.7.0 * Fixed invalid FSAA values crashing LÖVE. * Fixed a bunch of compiler warnings. * Fixed OS X not properly using UTIs for .love files. + * Fixed the modplug decoder not properly handeling files that fail to load. * Changed fonts, they're now po2 safe. * Changed the traceback in the error screen. diff --git a/src/modules/sound/lullaby/ModPlugDecoder.cpp b/src/modules/sound/lullaby/ModPlugDecoder.cpp index 06ff1ceaa..66b4e77e5 100644 --- a/src/modules/sound/lullaby/ModPlugDecoder.cpp +++ b/src/modules/sound/lullaby/ModPlugDecoder.cpp @@ -43,11 +43,11 @@ namespace lullaby // Load the module. plug = ModPlug_Load(data->getData(), data->getSize()); - - ModPlug_SetMasterVolume(plug, 512); - + if(plug == 0) throw love::Exception("Could not load file with ModPlug."); + + ModPlug_SetMasterVolume(plug, 512); } ModPlugDecoder::~ModPlugDecoder()