[Libreoffice-commits] core.git: sw/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri Mar 26 19:39:57 UTC 2021


 sw/source/core/text/itrcrsr.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 9befa8b1743526759b88e56afc98a78ba25100f6
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Mar 26 16:26:31 2021 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Mar 26 20:39:11 2021 +0100

    cid#1474452 Unchecked dynamic_cast
    
    Change-Id: Ib50140fad741d34eae0dfe28fd4ed03024d11e96
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113165
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index 4c39874eb862..f7c6380cb3bb 100644
--- a/sw/source/core/text/itrcrsr.cxx
+++ b/sw/source/core/text/itrcrsr.cxx
@@ -1558,9 +1558,9 @@ TextFrameIndex SwTextCursor::GetModelPositionForViewPoint( SwPosition *pPos, con
             if ( pPor->IsPostItsPortion() || pPor->IsBreakPortion() ||
                  pPor->InToxRefGrp() )
             {
-                if (pPor->IsPostItsPortion())
+                SwPostItsPortion* pPostItsPortion = pPor->IsPostItsPortion() ? dynamic_cast<SwPostItsPortion*>(pPor) : nullptr;
+                if (pPostItsPortion)
                 {
-                    SwPostItsPortion* pPostItsPortion = dynamic_cast<SwPostItsPortion*>(pPor);
                     if (!pPostItsPortion->IsScript()) // tdf#141079
                     {
                         // Offset would be nCurrStart + nLength below, do the same for post-it portions.


More information about the Libreoffice-commits mailing list