Made recent utilities a bit more robust
authorMartin Taal <martin.taal@openbravo.com>
Tue, 25 Jan 2011 23:48:58 +0100
changeset 10128 67117d6c25f3
parent 10127 72003d0cf144
child 10129 b9c4daa3bff7
Made recent utilities a bit more robust
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-recent-utilities.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-recent-utilities.js	Tue Jan 25 23:48:36 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-recent-utilities.js	Tue Jan 25 23:48:58 2011 +0100
@@ -84,9 +84,14 @@
     //
     // Parameters:
     // * {{{propertyName}}}: the name under which the recent value is stored.
-    // * {{{choiceObject}}}: the object defining the last user choice.
+    // * {{{choiceObject}}}: the object defining the last user choice, can be null
+    //                        in this case the call returns without changing things.
     //
     addRecent: function(/* String */propertyName, /* Object */ choiceObject){
+      // in some cases the choiceobject is not set, just ignore those
+      if (!choiceObject) {
+        return;
+      }
       var currentRecentValue = this.getRecentValue(propertyName);
       var currentIndex = -1;
       for (var i = 0; i < currentRecentValue.length; i++) {