summaryrefslogtreecommitdiff
path: root/starmath/source/node.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-05-04 21:46:31 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-05-05 08:05:16 +0200
commit13894996601daf10d133f4a71eb0b26794d782bc (patch)
tree0040f2c81ffd7984373ba27234cea24fbbc3d916 /starmath/source/node.cxx
parentd83b1383ffbe98502c196cccae4bcb2eb3978f6a (diff)
handle empty Rectangle better in starmath
which required fixing a unit test to call Prepare, otherwise the nodes are not ready for layout Change-Id: I763c1b05d4dfafa73ebaee55d080876848de94f6 Reviewed-on: https://gerrit.libreoffice.org/71800 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'starmath/source/node.cxx')
-rw-r--r--starmath/source/node.cxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx
index 97d97582826d..fcdcbbdb2e07 100644
--- a/starmath/source/node.cxx
+++ b/starmath/source/node.cxx
@@ -2064,6 +2064,7 @@ void SmTextNode::Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell, i
SetRectHorAlign( RectHorAlign::Left );
maText = GetToken().aText;
+ assert(!maText.isEmpty());
GetFont() = rFormat.GetFont(GetFontDesc());
if (IsItalic( GetFont() ))
@@ -2402,7 +2403,9 @@ void SmMathSymbolNode::AdaptToY(OutputDevice &rDev, sal_uLong nHeight)
// get denominator of error factor for height
long nTmpBorderWidth = GetFont().GetBorderWidth();
- long nDenom = SmRect(aTmpDev, nullptr, GetText(), nTmpBorderWidth).GetHeight();
+ long nDenom = 0;
+ if (!GetText().isEmpty())
+ nDenom = SmRect(aTmpDev, nullptr, GetText(), nTmpBorderWidth).GetHeight();
// scale fontwidth with this error factor
aFntSize.setHeight( aFntSize.Height() * nHeight );