summaryrefslogtreecommitdiff
path: root/starmath/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-11-23 11:30:00 +0000
committerCaolán McNamara <caolanm@redhat.com>2012-11-23 11:51:20 +0000
commitb3edb2410387e0ad63ee663cd3b706076bea3edb (patch)
treea50ec01f1a73ad1220e1af7d8367050534e76c31 /starmath/source
parent0ad608e83b7a61680d1397d2f5355235f52419d9 (diff)
try to fix and reenable starmath unit tests
Change-Id: I4c2a1476ea6ae12fdebb8301b68eab8060bc86f8
Diffstat (limited to 'starmath/source')
-rw-r--r--starmath/source/visitors.cxx14
1 files changed, 9 insertions, 5 deletions
diff --git a/starmath/source/visitors.cxx b/starmath/source/visitors.cxx
index dc930ecc65ea..9236a1f1684d 100644
--- a/starmath/source/visitors.cxx
+++ b/starmath/source/visitors.cxx
@@ -2510,11 +2510,15 @@ void SmNodeToTextVisitor::Visit( SmLineNode* pNode )
void SmNodeToTextVisitor::Visit( SmExpressionNode* pNode )
{
bool bracketsNeeded = pNode->GetNumSubNodes() != 1 || pNode->GetSubNode(0)->GetType() == NBINHOR;
- // nested subsups
- bracketsNeeded |=
- pNode->GetParent()->GetType() == NSUBSUP &&
- pNode->GetNumSubNodes() == 1 &&
- pNode->GetSubNode(0)->GetType() == NSUBSUP;
+ if (!bracketsNeeded)
+ {
+ const SmNode *pParent = pNode->GetParent();
+ // nested subsups
+ bracketsNeeded =
+ pParent && pParent->GetType() == NSUBSUP &&
+ pNode->GetNumSubNodes() == 1 &&
+ pNode->GetSubNode(0)->GetType() == NSUBSUP;
+ }
if (bracketsNeeded) {
Append( "{ " );