summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-09-20 20:27:32 +0100
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-09-22 20:11:03 +0200
commit4605d36e7ee5ebe4776ab4bc78b255ac5f33c3ab (patch)
tree5ee10b0a7fc0cb97f06bc19f25777145daadd90c /sw
parent490e64cdc890c5998d54d4ad3c3ac85e7e8e3bee (diff)
cid#1607080 Overflowed constant
this doesn't make any sense to me with: m_xEditEngine->GetText(nParaCount - 1) before a check against non-0 nParaCount int nPara = nParaCount ? nParaCount - 1 : 0; surely GetText(nParaCount - 1) can at best return an empty string like this since: commit c9596fa3c6e7137ad9c4f8cdaa69c625d37e7bc6 CommitDate: Mon Mar 7 16:35:17 2005 +0000 INTEGRATION: CWS os49 (1.4.84); FILE MERGED Change-Id: I6c605f27fee0b8c9f58a0e2bc7bc975a2efd1f8c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173750 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/ui/dbui/mmaddressblockpage.cxx16
1 files changed, 9 insertions, 7 deletions
diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx
index 72a407ae0b87..a6d6cb10d4b3 100644
--- a/sw/source/ui/dbui/mmaddressblockpage.cxx
+++ b/sw/source/ui/dbui/mmaddressblockpage.cxx
@@ -1160,15 +1160,17 @@ void AddressMultiLineEdit::SetText( const OUString& rStr )
}
// add two empty paragraphs at the end
- if(m_pParentDialog->m_eType == SwCustomizeAddressBlockDialog::ADDRESSBLOCK_NEW ||
- m_pParentDialog->m_eType == SwCustomizeAddressBlockDialog::ADDRESSBLOCK_EDIT)
+ if (nParaCount > 0)
{
- sal_Int32 nLastLen = m_xEditEngine->GetText(nParaCount - 1).getLength();
- if(nLastLen)
+ if(m_pParentDialog->m_eType == SwCustomizeAddressBlockDialog::ADDRESSBLOCK_NEW ||
+ m_pParentDialog->m_eType == SwCustomizeAddressBlockDialog::ADDRESSBLOCK_EDIT)
{
- int nPara = nParaCount ? nParaCount - 1 : 0;
- ESelection aPaM(nPara, nLastLen, nPara, nLastLen);
- m_xEditEngine->QuickInsertText(u"\n \n "_ustr, aPaM);
+ sal_Int32 nLastLen = m_xEditEngine->GetText(nParaCount - 1).getLength();
+ if (nLastLen)
+ {
+ ESelection aPaM(nParaCount - 1, nLastLen, nParaCount - 1, nLastLen);
+ m_xEditEngine->QuickInsertText(u"\n \n "_ustr, aPaM);
+ }
}
}