diff options
author | Kurt Zenker <kz@openoffice.org> | 2009-12-03 17:39:45 +0100 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2009-12-03 17:39:45 +0100 |
commit | c0df0e81a4dbb17f2743dea3b19fa36783bdd678 (patch) | |
tree | a8a4d22fffbaee32fb1181ea6d44847c2a13cce1 /tools/source | |
parent | 04c4b78260696fdef70948042fa3679287fdd628 (diff) | |
parent | 3c6d6a02196c40e5bf2c4ebac7e62ebf968cac25 (diff) |
CWS-TOOLING: integrate CWS validityref
Diffstat (limited to 'tools/source')
-rw-r--r-- | tools/source/memtools/table.cxx | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/tools/source/memtools/table.cxx b/tools/source/memtools/table.cxx index ba0dbb8a90f9..75aafddb6c58 100644 --- a/tools/source/memtools/table.cxx +++ b/tools/source/memtools/table.cxx @@ -125,26 +125,37 @@ BOOL Table::Insert( ULONG nKey, void* p ) { USHORT n = 0; USHORT nTempCount = (USHORT)nCount * 2; - void** pNodes = Container::ImpGetOnlyNodes(); - ULONG nCompareKey = (ULONG)(*pNodes); - while ( nKey > nCompareKey ) + //<!--Modified by PengYunQuan for resolving a NULL pointer access + + if( void** pNodes = Container::ImpGetOnlyNodes() ) { - n += 2; - pNodes += 2; - if ( n < nTempCount ) - nCompareKey = (ULONG)(*pNodes); - else + ULONG nCompareKey = (ULONG)(*pNodes); + while ( nKey > nCompareKey ) { - nCompareKey = 0; - break; + n += 2; + pNodes += 2; + if ( n < nTempCount ) + nCompareKey = (ULONG)(*pNodes); + else + { + nCompareKey = 0; + break; + } } - } - // Testen, ob sich der Key schon in der Tabelle befindet - if ( nKey == nCompareKey ) - return FALSE; + // Testen, ob sich der Key schon in der Tabelle befindet + if ( nKey == nCompareKey ) + return FALSE; - i = n; + i = n; + } + else + { + i = 0; + if ( ImplGetIndex( nKey, &i ) != TABLE_ENTRY_NOTFOUND ) + return FALSE; + } + //-->Modified by PengYunQuan for resolving a NULL pointer access } else { |