From b1f5290dfab8991bf88a226578b1e6ca98bf408c Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Tue, 7 Jul 2015 17:45:27 +0200 Subject: fix some nullpointers from proxy implementation --- .../org/sufficientlysecure/keychain/keyimport/HkpKeyserver.java | 9 +++++++-- .../keychain/ui/adapter/ImportKeysListCloudLoader.java | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'OpenKeychain/src/main/java/org') diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/HkpKeyserver.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/HkpKeyserver.java index bd85b7a0a..8048f1fea 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/HkpKeyserver.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/HkpKeyserver.java @@ -209,8 +209,13 @@ public class HkpKeyserver extends Keyserver { Log.w(Constants.TAG, e); } - client.setProxy(proxy); - client.setConnectTimeout(proxy != null ? 30000 : 5000, TimeUnit.MILLISECONDS); + if (proxy != null) { + client.setProxy(proxy); + client.setConnectTimeout(30000, TimeUnit.MILLISECONDS); + } else { + client.setProxy(Proxy.NO_PROXY); + client.setConnectTimeout(5000, TimeUnit.MILLISECONDS); + } client.setReadTimeout(45000, TimeUnit.MILLISECONDS); return client; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListCloudLoader.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListCloudLoader.java index c7f69207c..9d3d230d4 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListCloudLoader.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListCloudLoader.java @@ -103,7 +103,7 @@ public class ImportKeysListCloudLoader ArrayList searchResult = CloudSearch.search( mServerQuery, mCloudPrefs, - mParcelableProxy.getProxy() + mParcelableProxy != null ? mParcelableProxy.getProxy() : null ); mEntryList.clear(); -- cgit v1.2.3