sw/source/uibase/utlui/content.cxx |    1 +
 1 file changed, 1 insertion(+)

New commits:
commit be32cb92103326da2c744bc85d82b9c788f4e98b
Author:     Jim Raykowski <rayk...@gmail.com>
AuthorDate: Thu Jul 28 08:33:37 2022 -0800
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Sat Jul 30 07:07:22 2022 +0200

    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.kagan...@collabora.com>

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())

Reply via email to