Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 77ea8a36 authored by Narayan Kamath's avatar Narayan Kamath Committed by Android Git Automerger
Browse files

am 793bbd29: am 909427d0: am f588d2df: am d0ec6d8c: am bc2a449a: am cb4d3ec1:...

am 793bbd29: am 909427d0: am f588d2df: am d0ec6d8c: am bc2a449a: am cb4d3ec1: Merge "Fix preference puts with "null" values."

* commit '793bbd29':
  Fix preference puts with "null" values.
parents 7cbdb543 793bbd29
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -420,13 +420,15 @@ final class SharedPreferencesImpl implements SharedPreferences {
                    for (Map.Entry<String, Object> e : mModified.entrySet()) {
                    for (Map.Entry<String, Object> e : mModified.entrySet()) {
                        String k = e.getKey();
                        String k = e.getKey();
                        Object v = e.getValue();
                        Object v = e.getValue();
                        if (v == this) {  // magic value for a removal mutation
                        // "this" is the magic value for a removal mutation. In addition,
                        // setting a value to "null" for a given key is specified to be
                        // equivalent to calling remove on that key.
                        if (v == this || v == null) {
                            if (!mMap.containsKey(k)) {
                            if (!mMap.containsKey(k)) {
                                continue;
                                continue;
                            }
                            }
                            mMap.remove(k);
                            mMap.remove(k);
                        } else {
                        } else {
                            boolean isSame = false;
                            if (mMap.containsKey(k)) {
                            if (mMap.containsKey(k)) {
                                Object existingValue = mMap.get(k);
                                Object existingValue = mMap.get(k);
                                if (existingValue != null && existingValue.equals(v)) {
                                if (existingValue != null && existingValue.equals(v)) {