From 3f7913b69468317c63c176201a9d4d65c0cecee7 Mon Sep 17 00:00:00 2001 From: garak Date: Fri, 23 Jun 2023 13:51:52 -0400 Subject: [PATCH] fix segfault in map image exporter --- src/ui/mapimageexporter.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ui/mapimageexporter.cpp b/src/ui/mapimageexporter.cpp index 66c0dd0b..c6aef0cd 100644 --- a/src/ui/mapimageexporter.cpp +++ b/src/ui/mapimageexporter.cpp @@ -98,8 +98,11 @@ void MapImageExporter::saveImage() { progress.setMaximum(1); progress.setValue(0); - int maxWidth = this->map->getWidth() * 16; - int maxHeight = this->map->getHeight() * 16; + Layout *layout = this->map->layout; + if (!layout) break; + + int maxWidth = layout->getWidth() * 16; + int maxHeight = layout->getHeight() * 16; if (showBorder) { maxWidth += 2 * STITCH_MODE_BORDER_DISTANCE * 16; maxHeight += 2 * STITCH_MODE_BORDER_DISTANCE * 16;