sc/source/ui/view/viewdata.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit a32bd25acf541168c332d18e44be3a4ab558deec
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Tue Apr 26 10:00:58 2022 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Tue Apr 26 13:57:55 2022 +0200

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

diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 054305c5278f..59be2185c1c6 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -3335,8 +3335,8 @@ void ScViewData::ReadUserData(std::u16string_view rData)
     // SetPagebreakMode must always be called due to CalcPPT / RecalcPixPos()
 
     // sheet may have become invalid (for instance last version):
-    SCTAB nNewTab = static_cast<SCTAB>(o3tl::toInt64(o3tl::getToken(rData, 0, 
';', nMainIdx)));
-    if (mrDoc.HasTable(nNewTab))
+    sal_Int64 nNewTab = o3tl::toInt64(o3tl::getToken(rData, 0, ';', nMainIdx));
+    if (nNewTab >= 0 && mrDoc.HasTable(nNewTab))
         SetTabNo(nNewTab);
 
     // if available, get tab bar width:

Reply via email to