changeset 16774:745fe7d2536d

8011540: PropertyMap histories should not begin with empty map Reviewed-by: lagergren, sundar Contributed-by: james.laskey@oracle.com
author jlaskey
date Thu, 04 Apr 2013 09:05:38 -0300
parents fcf1b6c58970
children a19a1107f33e
files nashorn/src/jdk/nashorn/internal/runtime/PropertyMap.java
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/nashorn/src/jdk/nashorn/internal/runtime/PropertyMap.java	Tue Apr 02 11:38:04 2013 -0300
+++ b/nashorn/src/jdk/nashorn/internal/runtime/PropertyMap.java	Thu Apr 04 09:05:38 2013 -0300
@@ -540,11 +540,13 @@
      * @param newMap   Modified {@link PropertyMap}.
      */
     private void addToHistory(final Property property, final PropertyMap newMap) {
-        if (history == null) {
-            history = new LinkedHashMap<>();
+        if (!properties.isEmpty()) {
+            if (history == null) {
+                history = new LinkedHashMap<>();
+            }
+
+            history.put(property, newMap);
         }
-
-        history.put(property, newMap);
     }
 
     /**