diff --git a/G-Earth/src/main/java/gearth/protocol/connection/proxy/RawIpProxyProvider.java b/G-Earth/src/main/java/gearth/protocol/connection/proxy/RawIpProxyProvider.java
index 1c16c13..86184c4 100644
--- a/G-Earth/src/main/java/gearth/protocol/connection/proxy/RawIpProxyProvider.java
+++ b/G-Earth/src/main/java/gearth/protocol/connection/proxy/RawIpProxyProvider.java
@@ -224,6 +224,9 @@ public class RawIpProxyProvider extends ProxyProvider {
}
private void saveCurrentConnectionsCache(JSONObject connections) {
+ if (!Cacher.getCacheContents().has(proxy.getActual_domain())) {
+ Cacher.put(RAWIP_CONNECTIONS, new JSONObject());
+ }
JSONObject gearthConnections = Cacher.getCacheContents().getJSONObject(RAWIP_CONNECTIONS);
gearthConnections.put(proxy.getActual_domain(), connections);
Cacher.put(RAWIP_CONNECTIONS, gearthConnections);
@@ -231,18 +234,16 @@ public class RawIpProxyProvider extends ProxyProvider {
static private JSONObject getCurrentConnectionsCache(String actual_host) {
+ if (!Cacher.getCacheContents().has(actual_host)) {
+ Cacher.put(RAWIP_CONNECTIONS, new JSONObject());
+ }
JSONObject gearthConnections = Cacher.getCacheContents().getJSONObject(RAWIP_CONNECTIONS);
- if (gearthConnections == null) {
- gearthConnections = new JSONObject();
+
+ if (!gearthConnections.has(actual_host)) {
+ gearthConnections.put(actual_host, new JSONObject());
Cacher.put(RAWIP_CONNECTIONS, gearthConnections);
}
- JSONObject connections = gearthConnections.getJSONObject(actual_host);
- if (connections == null) {
- connections = new JSONObject();
- gearthConnections.put(actual_host, connections);
- Cacher.put(RAWIP_CONNECTIONS, gearthConnections);
- }
- return connections;
+ return gearthConnections.getJSONObject(actual_host);
}
static boolean isNoneConnected(String actual_host) {
diff --git a/G-Earth/src/main/java/gearth/ui/extra/ExtraController.java b/G-Earth/src/main/java/gearth/ui/extra/ExtraController.java
index 1cf96d8..1440f67 100644
--- a/G-Earth/src/main/java/gearth/ui/extra/ExtraController.java
+++ b/G-Earth/src/main/java/gearth/ui/extra/ExtraController.java
@@ -52,8 +52,8 @@ public class ExtraController extends SubForm implements SocksConfiguration {
txtarea_notepad.setText(notepadInitValue);
}
- JSONObject socksInitValue = Cacher.getCacheContents().getJSONObject(SOCKS_CACHE_KEY);
- if (socksInitValue != null) {
+ if (Cacher.getCacheContents().has(SOCKS_CACHE_KEY)) {
+ JSONObject socksInitValue = Cacher.getCacheContents().getJSONObject(SOCKS_CACHE_KEY);
txt_socksIp.setText(socksInitValue.getString(SOCKS_IP));
txt_socksPort.setText(socksInitValue.getString(SOCKS_PORT));
cbx_ignoreSocksOnce.setSelected(socksInitValue.getBoolean(IGNORE_ONCE));
diff --git a/G-Earth/src/main/resources/gearth/ui/extra/Extra.fxml b/G-Earth/src/main/resources/gearth/ui/extra/Extra.fxml
index 364f018..ba85ba7 100644
--- a/G-Earth/src/main/resources/gearth/ui/extra/Extra.fxml
+++ b/G-Earth/src/main/resources/gearth/ui/extra/Extra.fxml
@@ -36,8 +36,8 @@
-
-
+
+
@@ -48,7 +48,7 @@
-
+
@@ -56,7 +56,7 @@
-
+
@@ -66,7 +66,7 @@
-
+