Kaydet (Commit) 82a0827f authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#1158249 Dereference before null check

Change-Id: I884ad35de8c067671ddd5143b2dc4af784cabe0c
üst 39fac0c7
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment