summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-02-04 10:22:03 +0000
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-02-04 13:13:03 +0100
commitf9dcaeb021bbcad0d152e6be1f4d2719700545ce (patch)
tree785518cd48185dec002b10ff541c81c741b8f70b /sw/source
parentc674f8d9fe5d6cda417bfdd71609ca6743595124 (diff)
cid#1591496 Dereference null return value
Change-Id: Ic26b910cc9243607641a19ceb2988ed3011939ad Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162971 Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/layout/atrfrm.cxx33
1 files changed, 18 insertions, 15 deletions
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 15d2d309d571..f657aa195066 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -2628,22 +2628,25 @@ void SwFrameFormat::SetFormatName( const OUString& rNewName, bool bBroadcast )
}
// update accessibility sidebar object name if we modify the object name on the navigator bar
- if (!aHint.m_sOld.isEmpty() && aHint.m_sOld != aHint.m_sNew)
+ const bool bUpdateA11yName = !aHint.m_sOld.isEmpty() && aHint.m_sOld != aHint.m_sNew;
+ if (!bUpdateA11yName)
+ return;
+ SwFlyFrame* pSFly = SwIterator<SwFlyFrame, SwFormat>(*this).First();
+ if (!pSFly)
+ return;
+ SwFrame *pSFlyLower = pSFly->Lower();
+ if (!pSFlyLower)
+ return;
+ if (!pSFlyLower->IsNoTextFrame())
+ {
+ SwContentFrame* pContent = pSFly->ContainsContent();
+ if (SwTextNode* pSwTxtNode = pContent ? static_cast<SwTextFrame*>(pContent)->GetTextNodeFirst() : nullptr)
+ pSwTxtNode->resetAndQueueAccessibilityCheck(true);
+ }
+ else
{
- if (SwFlyFrame* pSFly = SwIterator<SwFlyFrame, SwFormat>(*this).First())
- {
- SwFrame *pSFlyLower = pSFly->Lower();
- if (pSFlyLower && !pSFlyLower->IsNoTextFrame())
- {
- if (SwTextNode* pSwTxtNode = static_cast<SwTextFrame*>(pSFly->ContainsContent())->GetTextNodeFirst())
- pSwTxtNode->resetAndQueueAccessibilityCheck(true);
- }
- else
- {
- if (SwNode* pSwNode = static_cast<SwNoTextFrame*>(pSFlyLower)->GetNode())
- pSwNode->resetAndQueueAccessibilityCheck(true);
- }
- }
+ if (SwNode* pSwNode = static_cast<SwNoTextFrame*>(pSFlyLower)->GetNode())
+ pSwNode->resetAndQueueAccessibilityCheck(true);
}
}
else