diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-12-16 11:54:18 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-12-16 14:47:26 +0100 |
commit | d67058ff3dd723cc616237216ef28e8dd1f4d611 (patch) | |
tree | 8cca77cac20cea8a04bda201293f3b263bc2cfc8 /sc/source/ui/uitest | |
parent | b824634cbdc7bcacb0b67b8b1bcd17846273e85a (diff) |
uitest: sc: make sure the tab number exists
Otherwise, something like
gridwin.executeAction("SELECT", mkPropertyValues({"TABLE": "100"}))
would create a new tab called Sheet101
Change-Id: I052c68a1881bfe0a32e35a62f5c4f557ef10db8d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126917
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc/source/ui/uitest')
-rw-r--r-- | sc/source/ui/uitest/uiobject.cxx | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sc/source/ui/uitest/uiobject.cxx b/sc/source/ui/uitest/uiobject.cxx index 14e464c0bf20..19b32fddfb8b 100644 --- a/sc/source/ui/uitest/uiobject.cxx +++ b/sc/source/ui/uitest/uiobject.cxx @@ -165,7 +165,15 @@ void ScGridWinUIObject::execute(const OUString& rAction, sal_Int32 nTab = rStr.toUInt32(); ScTabView* pTabView = mxGridWindow->getViewData().GetView(); if (pTabView) - pTabView->SetTabNo(nTab); + { + ScDocument& rDoc = mxGridWindow->getViewData().GetDocument(); + if( nTab < rDoc.GetTableCount() ) + pTabView->SetTabNo(nTab); + else + { + SAL_WARN("sc.uitest", "incorrect table number"); + } + } } else if (rParameters.find("OBJECT") != rParameters.end()) { |