summaryrefslogtreecommitdiff
path: root/sc/source/ui/dbgui/tpsort.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui/dbgui/tpsort.cxx')
-rw-r--r--sc/source/ui/dbgui/tpsort.cxx2
1 files changed, 1 insertions, 1 deletions
diff --git a/sc/source/ui/dbgui/tpsort.cxx b/sc/source/ui/dbgui/tpsort.cxx
index 9b6c72ecdb22..04bb7d63e319 100644
--- a/sc/source/ui/dbgui/tpsort.cxx
+++ b/sc/source/ui/dbgui/tpsort.cxx
@@ -340,7 +340,7 @@ void ScTabPageSortFields::FillFieldLists( sal_uInt16 nStartField )
if ( bSortByRows )
{
OUString aFieldName;
- SCCOL nMaxCol = aSortData.nCol2;
+ SCCOL nMaxCol = pDoc->ClampToAllocatedColumns(nTab, aSortData.nCol2);
SCCOL col;
for ( col=nFirstSortCol; col<=nMaxCol && i<SC_MAXFIELDS; col++ )