From 3d9916c356ddbe5db2e9a509edecdf5161e7c6b7 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sun, 13 Sep 2026 08:16:41 +0200 Subject: [PATCH] fix(hash): Fix initialization of HashTableIteratorClass and make it work with an empty HashTableClass --- Core/Libraries/Source/WWVegas/WWLib/hash.cpp | 4 ++-- Core/Libraries/Source/WWVegas/WWLib/hash.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Core/Libraries/Source/WWVegas/WWLib/hash.cpp b/Core/Libraries/Source/WWVegas/WWLib/hash.cpp index b7969f68cf4..1cee44f208f 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/hash.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/hash.cpp @@ -131,7 +131,7 @@ int HashTableClass::Hash( const char * key ) void HashTableIteratorClass::First() { Index = 0; - NextEntry = Table.HashTable[ Index ]; + NextEntry = nullptr; Advance_Next(); Next(); // Accept the next we found, and go to the next next } @@ -148,11 +148,11 @@ void HashTableIteratorClass::Next() void HashTableIteratorClass::Advance_Next() { while ( NextEntry == nullptr ) { - Index++; if ( Index >= Table.HashTableSize ) { return; // Done! } NextEntry = Table.HashTable[ Index ]; + ++Index; } } diff --git a/Core/Libraries/Source/WWVegas/WWLib/hash.h b/Core/Libraries/Source/WWVegas/WWLib/hash.h index 99ff3015bcd..ee9c0690b8c 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/hash.h +++ b/Core/Libraries/Source/WWVegas/WWLib/hash.h @@ -93,7 +93,7 @@ class HashTableClass { class HashTableIteratorClass { public: - HashTableIteratorClass( HashTableClass & table ) : Table( table ) {} + HashTableIteratorClass( HashTableClass & table ) : Table( table ) { First(); } virtual ~HashTableIteratorClass() {} void First();