Bug fix: Removing an non-existing key from map should be a noop

Change-Id: I1a89327ab6b0a498fe403f17cbdb8783c41954a6
diff --git a/core/store/dist/src/main/java/org/onosproject/store/consistent/impl/DefaultDatabaseState.java b/core/store/dist/src/main/java/org/onosproject/store/consistent/impl/DefaultDatabaseState.java
index 18ae2c4..bd9cf69 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/consistent/impl/DefaultDatabaseState.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/consistent/impl/DefaultDatabaseState.java
@@ -151,9 +151,13 @@
                 !versionMatch.matches(currentValue == null ? null : currentValue.version())) {
             return Result.ok(new UpdateResult<>(false, mapName, key, currentValue, currentValue));
         } else {
-            if (value == null && currentValue != null) {
-                getMap(mapName).remove(key);
-                return Result.ok(new UpdateResult<>(true, mapName, key, currentValue, null));
+            if (value == null) {
+                if (currentValue == null) {
+                    return Result.ok(new UpdateResult<>(false, mapName, key, null, null));
+                } else {
+                    getMap(mapName).remove(key);
+                    return Result.ok(new UpdateResult<>(true, mapName, key, currentValue, null));
+                }
             }
             Versioned<byte[]> newValue = new Versioned<>(value, ++nextVersion);
             getMap(mapName).put(key, newValue);