sc/inc/SheetView.hxx           |    4 ----
 sc/source/ui/view/viewdata.cxx |    2 +-
 2 files changed, 1 insertion(+), 5 deletions(-)

New commits:
commit 93029445cea921cf2df82d209e596e4940200c2a
Author:     Tomaž Vajngerl <[email protected]>
AuthorDate: Mon Oct 6 23:41:44 2025 +0900
Commit:     Miklos Vajna <[email protected]>
CommitDate: Tue Oct 7 08:34:23 2025 +0200

    sc: fix wrong condition in IsValidTabNumber, clean SheetView
    
    It should be "&&" and not "||" or the function will never find an
    invalid tab number.
    
    Also remove default constructor and IsValid declaration from the
    SheetView class, as those are not used anymore.
    
    Change-Id: Ifd04009e10ce88c0248be7eded0fc4b6d5a0064e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191975
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Miklos Vajna <[email protected]>

diff --git a/sc/inc/SheetView.hxx b/sc/inc/SheetView.hxx
index 2f381f1472e9..352a28863a17 100644
--- a/sc/inc/SheetView.hxx
+++ b/sc/inc/SheetView.hxx
@@ -25,14 +25,10 @@ private:
     ScTable* mpTable = nullptr;
 
 public:
-    SheetView() = default;
     SheetView(ScTable* pTable);
 
     ScTable* getTablePointer() const;
     SCTAB getTableNumber() const;
-
-    /** A sheet view is valid if the pointer to the table is set */
-    bool isValid() const;
 };
 }
 
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index de07b7903dfd..6f9c24c4840b 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -882,7 +882,7 @@ ScDBFunc* ScViewData::GetView() const { return pView; }
 
 bool ScViewData::IsValidTabNumber(SCTAB nTabNumber) const
 {
-    return nTabNumber >= 0 || o3tl::make_unsigned(nTabNumber) < 
maTabData.size();
+    return nTabNumber >= 0 && o3tl::make_unsigned(nTabNumber) < 
maTabData.size();
 }
 
 void ScViewData::UpdateCurrentTab()

Reply via email to