sw/source/ui/vba/vbacontentcontrols.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 31d4db12d91d26f245ac40fc0adbb27ff1f93d6f
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Sun Nov 27 16:40:38 2022 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Sun Nov 27 20:16:42 2022 +0100

    cid#1517059 disentangle Improper use of negative value
    
    Change-Id: I907f54cd93d78fe3638e407c70253b94f849eac3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143351
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sw/source/ui/vba/vbacontentcontrols.cxx 
b/sw/source/ui/vba/vbacontentcontrols.cxx
index c33b80bb4264..4ef73f5d196e 100644
--- a/sw/source/ui/vba/vbacontentcontrols.cxx
+++ b/sw/source/ui/vba/vbacontentcontrols.cxx
@@ -41,10 +41,10 @@ lcl_getContentControl(std::u16string_view sName, 
std::u16string_view sTag,
     SwTextContentControl* pControl = nullptr;
     std::vector<OUString> vElementNames;
     SwContentControlManager& rManager = pDoc->GetContentControlManager();
-    size_t i = static_cast<size_t>(rIndex);
     const size_t nLen = rManager.GetCount();
     if (!pElementNames && rIndex > 0 && sName.empty() && sTag.empty() && 
sTitle.empty())
     {
+        size_t i = static_cast<size_t>(rIndex);
         // This is the normal get-by-index/getCount mode - no need for fancy 
filtering.
         if (i < nLen)
             pControl = rManager.Get(i);
@@ -55,7 +55,7 @@ lcl_getContentControl(std::u16string_view sName, 
std::u16string_view sTag,
     {
         // loop through everything collecting names, filtering by Tag/Title
         sal_Int32 nCounter = 0;
-        for (i = 0; i < nLen; ++i)
+        for (size_t i = 0; i < nLen; ++i)
         {
             pControl = rManager.Get(i);
             if (!sTag.empty()

Reply via email to