Tag: cws_src680_dba24
User: oj      
Date: 05/02/21 01:14:01

Modified:
 /dba/dbaccess/source/ui/tabledesign/
  TEditControl.cxx

Log:
 #119863 # check if index is less than vector

File Changes:

Directory: /dba/dbaccess/source/ui/tabledesign/
===============================================

File [changed]: TEditControl.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/tabledesign/TEditControl.cxx?r1=1.40.20.1&r2=1.40.20.2
Delta lines:  +14 -8
--------------------
--- TEditControl.cxx    10 Feb 2005 11:25:15 -0000      1.40.20.1
+++ TEditControl.cxx    21 Feb 2005 09:13:58 -0000      1.40.20.2
@@ -345,7 +345,7 @@
                xCon = GetView()->getController()->getConnection();
                Reference< XDatabaseMetaData> xMetaData = xCon.is() ? 
xCon->getMetaData() : Reference< XDatabaseMetaData>();
 
-               nMaxTextLen = ((xub_StrLen)xMetaData.is() ? 
xMetaData->getMaxColumnNameLength() : 0);
+               nMaxTextLen = ((xub_StrLen)xMetaData.is() ? 
static_cast<xub_StrLen>(xMetaData->getMaxColumnNameLength()) : 0);
 
                if( nMaxTextLen == 0 )
                        nMaxTextLen = EDIT_NOLIMIT;     
@@ -907,12 +907,16 @@
        ::std::vector<OTableRow*> vClipboardList;
        vClipboardList.reserve(GetSelectRowCount());
 
-       for( long nIndex=FirstSelectedRow(); nIndex>=0; 
nIndex=NextSelectedRow() )
+       for( long nIndex=FirstSelectedRow(); nIndex >= 0 && nIndex < 
static_cast<long>(m_pRowList->size()); nIndex=NextSelectedRow() )
        {
                pRow = (*m_pRowList)[nIndex];
+        OSL_ENSURE(pRow,"OTableEditorCtrl::CopyRows: Row is NULL!");
+        if ( pRow )
+        {
                pClipboardRow = new OTableRow( *pRow );
                vClipboardList.push_back( pClipboardRow);
        }
+       }
        if(!vClipboardList.empty())
        {
                OTableRowExchange* pData = new 
OTableRowExchange(vClipboardList);
@@ -1023,7 +1027,7 @@
        nOldDataPos = nIndex;
        bSaveOnMove = sal_False;
 
-       while( nIndex >= 0 )
+       while( nIndex >= 0 && nIndex < static_cast<long>(m_pRowList->size()) )
        {
                
//////////////////////////////////////////////////////////////////////
                // Zeile entfernen
@@ -1379,7 +1383,7 @@
                // Wenn eine der markierten Zeilen leer ist, kein Copy moeglich
                OTableRow* pRow;
                long nIndex = FirstSelectedRow();
-               while( nIndex >= 0 )
+        while( nIndex >= 0 && nIndex < static_cast<long>(m_pRowList->size()) )
                {
                        pRow = (*m_pRowList)[nIndex];
                        if( !pRow->GetActFieldDescr() )
@@ -1553,7 +1557,7 @@
        // - kein DROP erlaubt ist (s.o.) und die Spalte noch kein Required 
(not null) gesetzt hatte.
        long nIndex = FirstSelectedRow();
        OTableRow* pRow;
-       while( nIndex >= 0 )
+       while( nIndex >= 0 && nIndex < static_cast<long>(m_pRowList->size()) )
        {
                pRow = (*m_pRowList)[nIndex];
                OFieldDescription* pFieldDescr = pRow->GetActFieldDescr();
@@ -1807,7 +1811,7 @@
        if( bSet )
        {
                nIndex = FirstSelectedRow();
-               while( nIndex >= 0 )
+               while( nIndex >= 0 && nIndex < 
static_cast<long>(m_pRowList->size()) )
                {
                        
//////////////////////////////////////////////////////////////////////
                        // Key setzen
@@ -1867,6 +1871,8 @@
                // Alte Beschreibung speichern
                pDescrWin->SaveData( pActFieldDescr );
 
+    if ( nRow < 0 || nRow > static_cast<long>(m_pRowList->size()) )
+        return;
        //////////////////////////////////////////////////////////////////////
        // Neue Beschreibung darstellen
        OTableRow* pRow = (*m_pRowList)[nRow];




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to