diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-01-27 09:25:27 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-01-27 11:14:31 +0000 |
commit | 82a0827f329f67a9a76819d4fc6d21e69275746c (patch) | |
tree | 650e02f4cb37c1fcb33befccfac320b16ea1f28c /sw/source/core/access/accdoc.cxx | |
parent | 39fac0c7baa93ce46f871f1795c2f46c7be798f8 (diff) |
coverity#1158249 Dereference before null check
Change-Id: I884ad35de8c067671ddd5143b2dc4af784cabe0c
Diffstat (limited to 'sw/source/core/access/accdoc.cxx')
-rw-r--r-- | sw/source/core/access/accdoc.cxx | 80 |
1 files changed, 37 insertions, 43 deletions
diff --git a/sw/source/core/access/accdoc.cxx b/sw/source/core/access/accdoc.cxx index bcfe144af85d..5c27f98ba393 100644 --- a/sw/source/core/access/accdoc.cxx +++ b/sw/source/core/access/accdoc.cxx @@ -784,63 +784,57 @@ uno::Any SAL_CALL SwAccessibleDocument::getExtendedAttributes() sValue += ";"; - if(pCurrFrm!=NULL) + SwSectionFrm* pCurrSctFrm=((SwFrm*)pCurrFrm)->FindSctFrm(); + if(pCurrSctFrm!=NULL && pCurrSctFrm->GetSection()!=NULL ) { - SwSectionFrm* pCurrSctFrm=((SwFrm*)pCurrFrm)->FindSctFrm(); - if(pCurrSctFrm!=NULL && pCurrSctFrm->GetSection()!=NULL ) - { - sAttrName = "section-name:"; + sAttrName = "section-name:"; - sValue += sAttrName; - OUString sectionName = pCurrSctFrm->GetSection()->GetSectionName(); + sValue += sAttrName; + OUString sectionName = pCurrSctFrm->GetSection()->GetSectionName(); - sectionName = sectionName.replaceFirst( "\\" , "\\\\" ); - sectionName = sectionName.replaceFirst( "=" , "\\=" ); - sectionName = sectionName.replaceFirst( ";" , "\\;" ); - sectionName = sectionName.replaceFirst( "," , "\\," ); - sectionName = sectionName.replaceFirst( ":" , "\\:" ); + sectionName = sectionName.replaceFirst( "\\" , "\\\\" ); + sectionName = sectionName.replaceFirst( "=" , "\\=" ); + sectionName = sectionName.replaceFirst( ";" , "\\;" ); + sectionName = sectionName.replaceFirst( "," , "\\," ); + sectionName = sectionName.replaceFirst( ":" , "\\:" ); - sValue += sectionName; + sValue += sectionName; - sValue += ";"; + sValue += ";"; - //section-columns-number - { - sAttrName = "section-columns-number:"; + //section-columns-number + sAttrName = "section-columns-number:"; - nCurrCol = 1; + nCurrCol = 1; - if(pCurrCol!=NULL) + if(pCurrCol!=NULL) + { + SwLayoutFrm* pParent = pCurrCol->GetUpper(); + if(pParent!=NULL) { - SwLayoutFrm* pParent = pCurrCol->GetUpper(); - if(pParent!=NULL) + SwFrm* pCol = pParent->Lower(); + while(pCol&&(pCol!=pCurrCol)) { - SwFrm* pCol = pParent->Lower(); - while(pCol&&(pCol!=pCurrCol)) - { - pCol = pCol->GetNext(); - nCurrCol +=1; - } + pCol = pCol->GetNext(); + nCurrCol +=1; } } - sValue += sAttrName; - sValue += OUString::number( nCurrCol ) ; - sValue += ";"; - } - - //section-total-columns - { - sAttrName = "section-total-columns:"; - const SwFmtCol &rFmtSctCol=pCurrSctFrm->GetAttrSet()->GetCol(); - sal_uInt16 nSctColCount=rFmtSctCol.GetNumCols(); - nSctColCount = nSctColCount>0?nSctColCount:1; - sValue += sAttrName; - sValue += OUString::number( nSctColCount ) ; - - sValue += ";"; - } } + sValue += sAttrName; + sValue += OUString::number( nCurrCol ) ; + sValue += ";"; + + //section-total-columns + sAttrName = "section-total-columns:"; + const SwFmtCol &rFmtSctCol=pCurrSctFrm->GetAttrSet()->GetCol(); + sal_uInt16 nSctColCount=rFmtSctCol.GetNumCols(); + nSctColCount = nSctColCount>0?nSctColCount:1; + sValue += sAttrName; + sValue += OUString::number( nSctColCount ) ; + + sValue += ";"; } + anyAtrribute <<= sValue; } return anyAtrribute; |