From 30e48300944ce478be110f1e0c2bdad1aec1cb58 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Sun, 14 Oct 2012 18:56:18 +0200 Subject: [PATCH] Do not crash if start or end layout don't exist BUGS: 308003 FIXED-IN: 4.9.3 --- core/textdocumentgenerator_p.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/textdocumentgenerator_p.h b/core/textdocumentgenerator_p.h index c266cf627..749d6f2d9 100644 --- a/core/textdocumentgenerator_p.h +++ b/core/textdocumentgenerator_p.h @@ -36,6 +36,11 @@ namespace TextDocumentUtils { QTextLayout *startLayout = startBlock.layout(); QTextLayout *endLayout = endBlock.layout(); + if (!startLayout || !endLayout) { + kWarning() << "Start or end layout not found" << startLayout << endLayout; + page = -1; + return; + } int startPos = startPosition - startBlock.position(); int endPos = endPosition - endBlock.position();