From 1a499150c8c3125b7fd4c8e5a3fbba32ac55813a Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Thu, 8 Jan 2015 18:31:29 +0100 Subject: [PATCH] Push ! --- .../xephi/authme/datasource/MySQLThread.java | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/main/java/fr/xephi/authme/datasource/MySQLThread.java b/src/main/java/fr/xephi/authme/datasource/MySQLThread.java index e1cce2e68..fbc966b4d 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQLThread.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQLThread.java @@ -948,22 +948,24 @@ public class MySQLThread extends Thread implements DataSource { public void setUnlogged(String user) { Connection con = null; PreparedStatement pst = null; - try { - con = makeSureConnectionIsReady(); - pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnLogged + "=? WHERE " + columnName + "=?;"); - pst.setInt(1, 0); - pst.setString(2, user); - pst.executeUpdate(); - } catch (SQLException ex) { - ConsoleLogger.showError(ex.getMessage()); - return; - } catch (TimeoutException ex) { - ConsoleLogger.showError(ex.getMessage()); - return; - } finally { - close(pst); - close(con); - } + if (user != null) + try { + con = makeSureConnectionIsReady(); + pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnLogged + "=? WHERE " + columnName + "=?;"); + pst.setInt(1, 0); + pst.setString(2, user); + pst.executeUpdate(); + } catch (SQLException ex) { + ConsoleLogger.showError(ex.getMessage()); + return; + } catch (TimeoutException ex) { + ConsoleLogger.showError(ex.getMessage()); + return; + } + finally { + close(pst); + close(con); + } return; }