From fa4b418e881d9e418ef10b9dcdad0b09f11f9907 Mon Sep 17 00:00:00 2001 From: Kenny Root Date: Sun, 29 Mar 2015 21:40:20 +0100 Subject: Return empty port forward list if host arg is null There would be a NullPointerException if the host passed in was null, so just preclude it by checking. --- app/src/main/java/org/connectbot/util/HostDatabase.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/connectbot/util/HostDatabase.java b/app/src/main/java/org/connectbot/util/HostDatabase.java index d1d87c7..ff8a622 100644 --- a/app/src/main/java/org/connectbot/util/HostDatabase.java +++ b/app/src/main/java/org/connectbot/util/HostDatabase.java @@ -592,10 +592,13 @@ public class HostDatabase extends RobustSQLiteOpenHelper { /** * Returns a list of all the port forwards associated with a particular host ID. * @param host the host for which we want the port forward list - * @return port forwards associated with host ID + * @return port forwards associated with host ID or empty list if no match */ public List getPortForwardsForHost(HostBean host) { List portForwards = new LinkedList(); + if (host == null) { + return portForwards; + } synchronized (dbLock) { SQLiteDatabase db = this.getReadableDatabase(); -- cgit v1.2.3