From b8c2f430ad365bd29af202733b0aeae31675751d Mon Sep 17 00:00:00 2001 From: Eric Kok Date: Thu, 30 Oct 2014 11:13:59 +0100 Subject: [PATCH] Fixed some small potential crashes. --- app/src/main/java/org/transdroid/core/gui/log/Log.java | 2 +- .../java/org/transdroid/daemon/Aria2c/Aria2Adapter.java | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/transdroid/core/gui/log/Log.java b/app/src/main/java/org/transdroid/core/gui/log/Log.java index e297f845..d0bd08f5 100644 --- a/app/src/main/java/org/transdroid/core/gui/log/Log.java +++ b/app/src/main/java/org/transdroid/core/gui/log/Log.java @@ -61,7 +61,7 @@ public class Log implements ITLogger { DeleteBuilder db = errorLogDao.deleteBuilder(); db.setWhere(db.where().le(ErrorLogEntry.DATEANDTIME, new Date(new Date().getTime() - MAX_LOG_AGE))); errorLogDao.delete(db.prepare()); - } catch (SQLException e) { + } catch (Exception e) { android.util.Log.e(LOG_NAME, "Cannot write log message to database: " + e.toString()); } } diff --git a/app/src/main/java/org/transdroid/daemon/Aria2c/Aria2Adapter.java b/app/src/main/java/org/transdroid/daemon/Aria2c/Aria2Adapter.java index 08bde516..29c27eac 100644 --- a/app/src/main/java/org/transdroid/daemon/Aria2c/Aria2Adapter.java +++ b/app/src/main/java/org/transdroid/daemon/Aria2c/Aria2Adapter.java @@ -236,8 +236,10 @@ public class Aria2Adapter implements IDaemonAdapter { JSONArray signed = new JSONArray(); // Start with the secret token as parameter and then add the normal parameters signed.put("token:" + settings.getExtraPassword()); - for (int i = 0; i < params.length(); i++) { - signed.put(params.get(i)); + if (params != null) { + for (int i = 0; i < params.length(); i++) { + signed.put(params.get(i)); + } } params = signed; }