aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2010-08-17 22:51:24 +0000
committerFilippos Karapetis2010-08-17 22:51:24 +0000
commit3c010fc2f9542c892c78f3f0df3b32e2b88d6a5d (patch)
tree1ae13b109ff76bafdc401a3340def60eecf25929 /engines
parentb480f0f2f093e5606501cca455a77735693ce07e (diff)
downloadscummvm-rg350-3c010fc2f9542c892c78f3f0df3b32e2b88d6a5d.tar.gz
scummvm-rg350-3c010fc2f9542c892c78f3f0df3b32e2b88d6a5d.tar.bz2
scummvm-rg350-3c010fc2f9542c892c78f3f0df3b32e2b88d6a5d.zip
SCI: Fixed bug #3034501 - "LSL6: Segfault while leaving the penthouse"
svn-id: r52174
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/kpathing.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/engines/sci/engine/kpathing.cpp b/engines/sci/engine/kpathing.cpp
index 07d0a31f0b..89ba309288 100644
--- a/engines/sci/engine/kpathing.cpp
+++ b/engines/sci/engine/kpathing.cpp
@@ -1106,6 +1106,12 @@ static Polygon *convert_polygon(EngineState *s, reg_t polygon) {
}
}
+ // Check if the target polygon is still valid. It may have been released
+ // in the meantime (e.g. in LSL6, room 700, when using the elevator).
+ // Refer to bug #3034501.
+ if (segMan->getSegmentType(points.segment) != SEG_TYPE_DYNMEM)
+ return NULL;
+
for (i = skip; i < size; i++) {
Vertex *vertex = new Vertex(read_point(segMan, points, i));
poly->vertices.insertHead(vertex);