aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorDmitry Iskrich2016-08-06 21:36:21 +0300
committerEugene Sandulenko2016-08-06 21:36:14 +0200
commit551048118cca489eab17e71025c29fbd56ff7b82 (patch)
tree0ab641cd7036ddbb41ed65bf8eb420bc5af7719f /engines
parentb7f66e0c504a51c1dcf5b31888d3e7ddeb957af5 (diff)
downloadscummvm-rg350-551048118cca489eab17e71025c29fbd56ff7b82.tar.gz
scummvm-rg350-551048118cca489eab17e71025c29fbd56ff7b82.tar.bz2
scummvm-rg350-551048118cca489eab17e71025c29fbd56ff7b82.zip
DIRECTOR: Fix some image rendering seg faults
Diffstat (limited to 'engines')
-rw-r--r--engines/director/score.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 9b42f6e257..9fedb069e9 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -1263,6 +1263,14 @@ void Frame::renderSprites(Graphics::ManagedSurface &surface, bool renderTrail) {
continue;
}
+ if (!img->getSurface()) {
+ //TODO
+ //BMPDecoder doesnt cover all BITD resources (not all have first two bytes 'BM')
+ //Some BITD's first two bytes 0x6 0x0
+ warning("Can not load image %d", _sprites[i]->_castId);
+ continue;
+ }
+
uint32 regX = static_cast<BitmapCast *>(_sprites[i]->_cast)->regX;
uint32 regY = static_cast<BitmapCast *>(_sprites[i]->_cast)->regY;
uint32 rectLeft = static_cast<BitmapCast *>(_sprites[i]->_cast)->initialRect.left;
@@ -1339,7 +1347,7 @@ Image::ImageDecoder *Frame::getImageFrom(uint16 spriteId) {
return img;
}
- if (_vm->getSharedDIB()->contains(imgId)) {
+ if (_vm->getSharedDIB() != NULL && _vm->getSharedDIB()->contains(imgId)) {
img = new DIBDecoder();
img->loadStream(*_vm->getSharedDIB()->getVal(imgId));
return img;
@@ -1351,7 +1359,7 @@ Image::ImageDecoder *Frame::getImageFrom(uint16 spriteId) {
return img;
}
- if (_vm->getSharedBMP()->contains(imgId)) {
+ if (_vm->getSharedBMP() != NULL && _vm->getSharedBMP()->contains(imgId)) {
img = new Image::BitmapDecoder();
img->loadStream(*_vm->getSharedBMP()->getVal(imgId));
return img;