[Scummvm-git-logs] scummvm master -> 2da0a3e95f2f624fde96bb3924686db2df201d2d

criezy criezy at scummvm.org
Sun Mar 7 19:58:38 UTC 2021


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
2da0a3e95f GRIM: Fix unknown key error when loading savegame


Commit: 2da0a3e95f2f624fde96bb3924686db2df201d2d
    https://github.com/scummvm/scummvm/commit/2da0a3e95f2f624fde96bb3924686db2df201d2d
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2021-03-07T19:58:36Z

Commit Message:
GRIM: Fix unknown key error when loading savegame

Changed paths:
    engines/grim/pool.h


diff --git a/engines/grim/pool.h b/engines/grim/pool.h
index 1d19e82fae..72d10f6892 100644
--- a/engines/grim/pool.h
+++ b/engines/grim/pool.h
@@ -314,9 +314,10 @@ void PoolObject<T>::Pool::restoreObjects(SaveGame *state) {
 	Common::HashMap<int32, T *> tempMap;
 	for (int32 i = 0; i < size; ++i) {
 		int32 id = state->readLESint32();
-		T *t = _map.getVal(id);
-		_map.erase(id);
-		if (!t) {
+		T *t = nullptr;
+		if (_map.tryGetVal(id, t))
+			_map.erase(id);
+		else {
 			t = new T();
 			t->setId(id);
 		}




More information about the Scummvm-git-logs mailing list