# HG changeset patch
# User Ranjith S R <ranjith@qualiantech.com>
# Date 1548939250 -19800
#      Thu Jan 31 18:24:10 2019 +0530
# Node ID c2d6dfbf46bab7dc3faa8655e7238891ae11a95a
# Parent  4f1b78879df9cc99a6fa8dc5421e92889e7a091e
Related to issue 40058 : Validate Login Defaults when login

diff -r 4f1b78879df9 -r c2d6dfbf46ba src/org/openbravo/retail/posterminal/POSLoginHandler.java
--- a/src/org/openbravo/retail/posterminal/POSLoginHandler.java	Wed Jan 30 11:22:18 2019 +0100
+++ b/src/org/openbravo/retail/posterminal/POSLoginHandler.java	Thu Jan 31 18:24:10 2019 +0530
@@ -1,6 +1,6 @@
 /*
  ************************************************************************************
- * Copyright (C) 2012-2018 Openbravo S.L.U.
+ * Copyright (C) 2012-2019 Openbravo S.L.U.
  * Licensed under the Openbravo Commercial License version 1.0
  * You may obtain a copy of the License at http://www.openbravo.com/legal/obcl.html
  * or in the legal folder of this module distribution.
@@ -274,11 +274,12 @@
       query.setParameter("clientId", terminal.getClient().getId());
       query.setParameter("roleId", currentRole.getId());
       query.setMaxResults(1);
-      BigDecimal distance = BigDecimal.ONE;
-      distance.negate();
+      BigDecimal distance = null;
       try {
         distance = query.uniqueResult();
       } catch (Exception ex) {
+      }
+      if (distance == null) {
         distance = BigDecimal.ONE;
         distance.negate();
       }
