From 3c010fc2f9542c892c78f3f0df3b32e2b88d6a5d Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 17 Aug 2010 22:51:24 +0000 Subject: SCI: Fixed bug #3034501 - "LSL6: Segfault while leaving the penthouse" svn-id: r52174 --- engines/sci/engine/kpathing.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'engines') 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); -- cgit v1.2.3