From 159b1c6abcf0c6593b609ea9a84f5701e45fc314 Mon Sep 17 00:00:00 2001 From: Erik Hofman Date: Mon, 18 Jul 2016 11:59:47 +0200 Subject: [PATCH] Try to prevent a crash in unusual situations --- simgear/sound/readwav.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/simgear/sound/readwav.cxx b/simgear/sound/readwav.cxx index 82135492..81b51b37 100644 --- a/simgear/sound/readwav.cxx +++ b/simgear/sound/readwav.cxx @@ -249,14 +249,14 @@ namespace bool found_header = false; bool compressed = false; + uint16_t bitsPerSample = 8; + uint16_t numChannels = 1; uint32_t chunkLength; int32_t magic; uint16_t audioFormat; - uint16_t numChannels; uint32_t samplesPerSecond; uint32_t byteRate; uint16_t blockAlign; - uint16_t bitsPerSample; Codec *codec = codecLinear; if (!wavReadBE(fd, magic)) @@ -310,7 +310,7 @@ namespace } else { bitsPerSample *= 2; /* uLaw is 16-bit packed into 8 bits */ codec = codecULaw; - } + Br } break; case 17: /* IMA4 ADPCM */ if (alIsExtensionPresent((ALchar *)"AL_EXT_ima4") && -- 2.39.5