summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorNiklas Nebel <nn@openoffice.org>2009-11-16 13:48:33 +0100
committerNiklas Nebel <nn@openoffice.org>2009-11-16 13:48:33 +0100
commitefc43491417daa4f382bf4c54d6aa1dd2b158ea8 (patch)
treef379f37706e619a9b2721a6e3b037c24c92d4507 /tools
parent9312cb4741bf45017a1394faf587aa13f5172cc1 (diff)
validityref: #i103899# manual migration from svn (contribution from PengYunQuan)
Diffstat (limited to 'tools')
-rw-r--r--tools/source/memtools/table.cxx41
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
{