diff options
author | Joseph-Eugene Winzer | 2018-01-07 23:09:01 +0100 |
---|---|---|
committer | Thierry Crozat | 2018-01-23 02:15:46 +0000 |
commit | e40a0179628f312ebd8e8c0ae581dbd69fc2637a (patch) | |
tree | 4d7eaa0f5148cb5ad9fc567ad13ae7deadd26e64 /engines/supernova | |
parent | c0f47712c2ac160a571959a86fd4b711f058ed64 (diff) | |
download | scummvm-rg350-e40a0179628f312ebd8e8c0ae581dbd69fc2637a.tar.gz scummvm-rg350-e40a0179628f312ebd8e8c0ae581dbd69fc2637a.tar.bz2 scummvm-rg350-e40a0179628f312ebd8e8c0ae581dbd69fc2637a.zip |
SUPERNOVA: Fixes segfault if dat file not found
Diffstat (limited to 'engines/supernova')
-rw-r--r-- | engines/supernova/supernova.cpp | 5 | ||||
-rw-r--r-- | engines/supernova/supernova.h | 19 |
2 files changed, 17 insertions, 7 deletions
diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp index 8f4394c1c8..1f0eb9b917 100644 --- a/engines/supernova/supernova.cpp +++ b/engines/supernova/supernova.cpp @@ -121,6 +121,8 @@ SupernovaEngine::SupernovaEngine(OSystem *syst) DebugMan.addDebugChannel(kDebugGeneral, "general", "Supernova general debug channel"); _rnd = new Common::RandomSource("supernova"); + _soundMusic[0] = NULL; + _soundMusic[1] = NULL; } SupernovaEngine::~SupernovaEngine() { @@ -130,9 +132,6 @@ SupernovaEngine::~SupernovaEngine() { delete _rnd; delete _console; delete _gm; - for (int i = 0; i < kAudioNumSamples; ++i) { - delete[] _soundSamples[i]._buffer; - } delete _soundMusic[0]; delete _soundMusic[1]; } diff --git a/engines/supernova/supernova.h b/engines/supernova/supernova.h index 7a68b8ebcb..8b1fe40dad 100644 --- a/engines/supernova/supernova.h +++ b/engines/supernova/supernova.h @@ -76,6 +76,20 @@ private: ScreenBuffer *_last; }; +struct SoundSample { + SoundSample() + : _buffer(NULL) + , _length(0) + {} + + ~SoundSample() { + delete _buffer; + } + + byte *_buffer; + int _length; +}; + class SupernovaEngine : public Engine { public: explicit SupernovaEngine(OSystem *syst); @@ -91,10 +105,7 @@ public: byte _mouseNormal[256]; byte _mouseWait[256]; MSNImageDecoder *_currentImage; - struct SoundSample { - byte *_buffer; - int _length; - } _soundSamples[kAudioNumSamples]; + SoundSample _soundSamples[kAudioNumSamples]; Common::MemoryReadStream *_soundMusic[2]; Common::Event _event; int _screenWidth; |