details:   https://code.openbravo.com/erp/devel/pi/rev/4ed5406072b4
changeset: 30649:4ed5406072b4
user:      Carlos Aristu <carlos.aristu <at> openbravo.com>
date:      Tue Nov 15 09:57:34 2016 +0100
summary:   related to issue 34514: Prevent Null Pointer Exception

diffstat:

 
modules/org.openbravo.client.application/src/org/openbravo/client/application/CachedPreference.java
 |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r ffe59c8ae31f -r 4ed5406072b4 
modules/org.openbravo.client.application/src/org/openbravo/client/application/CachedPreference.java
--- 
a/modules/org.openbravo.client.application/src/org/openbravo/client/application/CachedPreference.java
       Tue Nov 15 09:50:43 2016 +0100
+++ 
b/modules/org.openbravo.client.application/src/org/openbravo/client/application/CachedPreference.java
       Tue Nov 15 09:57:34 2016 +0100
@@ -135,7 +135,10 @@
    *          String with the value assigned to the preference
    */
   public synchronized void setPreferenceValue(String propertyName, String 
preferenceValue) {
-    this.cachedPreference.put(propertyName, preferenceValue);
+    if (cachedPreference == null) {
+      cachedPreference = new HashMap<String, String>();
+    }
+    cachedPreference.put(propertyName, preferenceValue);
   }
 
   /**
@@ -146,7 +149,9 @@
    *          The name of the property related to the preference
    */
   public synchronized void invalidatePreferenceValue(String propertyName) {
-    this.cachedPreference.remove(propertyName);
+    if (cachedPreference != null) {
+      cachedPreference.remove(propertyName);
+    }
   }
 
   /**

------------------------------------------------------------------------------
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to