diff options
author | Jim Raykowski <raykowj@gmail.com> | 2022-07-28 08:33:37 -0800 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2022-07-30 07:07:22 +0200 |
commit | be32cb92103326da2c744bc85d82b9c788f4e98b (patch) | |
tree | cc41e75250a468b0d81990b969e8437eaf24dc85 | |
parent | c2746a665656b61927bbf551b4723ccfae8fa9c8 (diff) |
Assert downcast
In this case it should be guaranteed that pField is a pointer to
SwGetRefField by:
else if (pField->GetTypeId() == SwFieldTypesEnum::GetRef)
To follow best practice to allow some diagnostic in debug mode,
assert(dynamic_cast) before using static_cast to downcast.
Change-Id: Ib2c6fb4259b66d5059f1886e23d05fc1c2aa3682
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137578
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r-- | sw/source/uibase/utlui/content.cxx | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index a20e792a9fbd..a1eaab07fb87 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -683,6 +683,7 @@ void SwContentType::FillMemberList(bool* pbContentChanged) } else if (pField->GetTypeId() == SwFieldTypesEnum::GetRef) { + assert(dynamic_cast<const SwGetRefField*>(pField)); const SwGetRefField* pRefField(static_cast<const SwGetRefField*>(pField)); if (pRefField->IsRefToHeadingCrossRefBookmark() || pRefField->IsRefToNumItemCrossRefBookmark()) |