Fixes Issue 0023017. Checks if preference is null.
authorDavid Miguelez <david.miguelez@openbravo.com>
Fri, 08 Feb 2013 11:45:57 +0100
changeset 19619 2b5240d539cb
parent 19618 208b97d8cc6d
child 19620 96d1681cd223
Fixes Issue 0023017. Checks if preference is null.
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddPaymentFromTransaction.java
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddPaymentFromTransaction.java	Fri Feb 08 10:48:08 2013 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddPaymentFromTransaction.java	Fri Feb 08 11:45:57 2013 +0100
@@ -865,7 +865,11 @@
     obCriteria.add(Restrictions.in(Preference.PROPERTY_ORGANIZATION + ".id", OBContext
         .getOBContext().getReadableOrganizations()));
     Preference preference = (Preference) obCriteria.uniqueResult();
-    return "Y".equals(preference.getSearchKey());
+    if (preference != null) {
+      return "Y".equals(preference.getSearchKey());
+    } else {
+      return false;
+    }
 
   }
 }