sc/source/ui/uitest/uiobject.cxx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
New commits: commit d67058ff3dd723cc616237216ef28e8dd1f4d611 Author: Xisco Fauli <[email protected]> AuthorDate: Thu Dec 16 11:54:18 2021 +0100 Commit: Xisco Fauli <[email protected]> CommitDate: Thu Dec 16 14:47:26 2021 +0100 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 <[email protected]> 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()) {
