]> git.mxchange.org Git - simgear.git/blobdiff - simgear/sound/soundmgr_openal.cxx
Rearrange alut error checking a bit
[simgear.git] / simgear / sound / soundmgr_openal.cxx
index 7b18d61f65a52bfe238632e50dcf12974bfc9496..47b437487e0a6899f687afdf3c3fc2f9e473813e 100644 (file)
@@ -554,8 +554,8 @@ bool SGSoundMgr::load(string &samplepath, void **dbuf, int *fmt,
     ALfloat freqf;
     data = alutLoadMemoryFromFile(samplepath.c_str(), &format, &size, &freqf );
     freq = (ALsizei)freqf;
-    if (data == NULL) {
-        int error = alutGetError();
+    int error = alutGetError();
+    if (data == NULL || error != ALUT_ERROR_NO_ERROR) {
         string msg = "Failed to load wav file: ";
         msg.append(alutGetErrorString(error));
         throw sg_io_exception(msg.c_str(), sg_location(samplepath));