[Scummvm-git-logs] scummvm master -> 9be3246a3e7ea8848ca5f82682801f11dfe00dd3

grisenti noreply at scummvm.org
Wed May 31 06:09:18 UTC 2023


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:
9be3246a3e COMMON: Fix operator[] of StableMap


Commit: 9be3246a3e7ea8848ca5f82682801f11dfe00dd3
    https://github.com/scummvm/scummvm/commit/9be3246a3e7ea8848ca5f82682801f11dfe00dd3
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-05-31T08:09:14+02:00

Commit Message:
COMMON: Fix operator[] of StableMap

Changed paths:
    common/stablemap.h


diff --git a/common/stablemap.h b/common/stablemap.h
index d46ef65f9f8..7c198370459 100644
--- a/common/stablemap.h
+++ b/common/stablemap.h
@@ -112,9 +112,10 @@ public:
 	Val &operator[](const Key &theKey) {
 		iterator it = _items.lowerBound(theKey);
 		if (it == this->end() || !compareEqual(it->first, theKey)) {
-			return _items.insert(theKey).second;
+			iterator i = _items.insert(value_type(theKey, Val()));
+			return i->second;
 		}
-		return *it->second;
+		return it->second;
 	}
 
 	/**
@@ -166,7 +167,7 @@ public:
 	}
 
 private:
-	bool compareEqual(const Key &a, const Key &b) {
+	bool compareEqual(const Key &a, const Key &b) const {
 		return !_comp(a, b) && !_comp(b, a);
 	}
 




More information about the Scummvm-git-logs mailing list