aboutsummaryrefslogtreecommitdiff
path: root/engines/cge
diff options
context:
space:
mode:
authorJohannes Schickel2014-01-17 17:48:16 -0800
committerJohannes Schickel2014-01-17 17:48:16 -0800
commit417064e3116e9fbb5737f7f9f13acc54b914e7be (patch)
treee065882eaab8bf35ad436a9a6273605c78bab450 /engines/cge
parentb23f7640289fc1203d5e8ad3f27a24c403bcc4b3 (diff)
parentac4087856f02725c288e1cef6b089acf7a6121aa (diff)
downloadscummvm-rg350-417064e3116e9fbb5737f7f9f13acc54b914e7be.tar.gz
scummvm-rg350-417064e3116e9fbb5737f7f9f13acc54b914e7be.tar.bz2
scummvm-rg350-417064e3116e9fbb5737f7f9f13acc54b914e7be.zip
Merge pull request #417 from digitall/STACK_fixes
ALL: Fix optimization unstable code on checking for null after new.
Diffstat (limited to 'engines/cge')
-rw-r--r--engines/cge/cge_main.cpp14
-rw-r--r--engines/cge/sound.cpp4
2 files changed, 10 insertions, 8 deletions
diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp
index 5325558f8b..602b36d6ef 100644
--- a/engines/cge/cge_main.cpp
+++ b/engines/cge/cge_main.cpp
@@ -539,14 +539,12 @@ void CGEEngine::setMapBrick(int x, int z) {
debugC(1, kCGEDebugEngine, "CGEEngine::setMapBrick(%d, %d)", x, z);
Square *s = new Square(this);
- if (s) {
- char n[6];
- s->gotoxy(x * kMapGridX, kMapTop + z * kMapGridZ);
- sprintf(n, "%02d:%02d", x, z);
- _clusterMap[z][x] = 1;
- s->setName(n);
- _vga->_showQ->insert(s, _vga->_showQ->first());
- }
+ char n[6];
+ s->gotoxy(x * kMapGridX, kMapTop + z * kMapGridZ);
+ sprintf(n, "%02d:%02d", x, z);
+ _clusterMap[z][x] = 1;
+ s->setName(n);
+ _vga->_showQ->insert(s, _vga->_showQ->first());
}
void CGEEngine::keyClick() {
diff --git a/engines/cge/sound.cpp b/engines/cge/sound.cpp
index b378898955..892b826318 100644
--- a/engines/cge/sound.cpp
+++ b/engines/cge/sound.cpp
@@ -186,6 +186,10 @@ DataCk *Fx::load(int idx, int ref) {
DataCk *Fx::loadWave(EncryptedStream *file) {
byte *data = (byte *)malloc(file->size());
+
+ if (!data)
+ return 0;
+
file->read(data, file->size());
return new DataCk(data, file->size());