sd/source/ui/sidebar/DocumentHelper.cxx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
New commits: commit 440286f8f7ae520c327e308221dd009eedf7f67b Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Fri Oct 18 01:00:30 2024 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Fri Oct 18 08:43:05 2024 +0200 tdf#163486: PVS: condition is always true V654 The condition '!bFound' of loop is always true. Change-Id: Ib37444255641f902a6833e222dfe1ee001376ea3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175110 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sd/source/ui/sidebar/DocumentHelper.cxx b/sd/source/ui/sidebar/DocumentHelper.cxx index c72c8d5a7cb7..303ceb58850b 100644 --- a/sd/source/ui/sidebar/DocumentHelper.cxx +++ b/sd/source/ui/sidebar/DocumentHelper.cxx @@ -167,8 +167,7 @@ SdPage* DocumentHelper::GetSlideForMasterPage (SdPage const * pMasterPage) // In most cases a new slide has just been inserted so start with // the last page. sal_uInt16 nPageIndex (pDocument->GetSdPageCount(PageKind::Standard)-1); - bool bFound (false); - while ( ! bFound) + while (true) { pCandidate = pDocument->GetSdPage( nPageIndex, @@ -178,21 +177,20 @@ SdPage* DocumentHelper::GetSlideForMasterPage (SdPage const * pMasterPage) if (static_cast<SdPage*>(&pCandidate->TRG_GetMasterPage()) == pMasterPage) { - bFound = true; break; } } if (nPageIndex == 0) + { + // If no page was found, that referenced the given master page, reset + // the pointer that is returned. + pCandidate = nullptr; break; + } else nPageIndex --; } - - // If no page was found, that referenced the given master page, reset - // the pointer that is returned. - if ( ! bFound) - pCandidate = nullptr; } return pCandidate;