Skip to content

Commit

Permalink
Fixes a null pointer crash
Browse files Browse the repository at this point in the history
  • Loading branch information
jp-bennett committed Feb 3, 2016
1 parent 6524b52 commit 34d3560
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ model {
applicationId = "org.cipherdyne.fwknop2"
minSdkVersion.apiLevel = 15
targetSdkVersion.apiLevel = 23
versionCode = 22
versionName = "1.2"
versionCode = 23
versionName = "1.2.1"
}
}
android.buildTypes {
Expand Down
46 changes: 46 additions & 0 deletions app/src/main/java/biz/incomsystems/fwknop2/DBHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,52 @@ public Config getConfig (String nick) {

CurrentIndex.close();

// There was at least one reported crash related to an unexpected null returned from this function.
// This is a bit of a heavyhanded solution. (OK, it's an ugly hack)

if (config.ACCESS_IP == null) {
config.ACCESS_IP = "";
}
if (config.PORTS == null) {
config.PORTS = "";
}
if (config.SERVER_IP == null) {
config.SERVER_IP = "";
}
if (config.SERVER_PORT == null) {
config.SERVER_PORT = "";
}
if (config.SERVER_TIMEOUT == null) {
config.SERVER_TIMEOUT = "";
}
if (config.KEY == null) {
config.KEY = "";
}
if (config.HMAC == null) {
config.HMAC = "";
}
if (config.NAT_IP == null) {
config.NAT_IP = "";
}
if (config.NAT_PORT == null) {
config.NAT_PORT = "";
}
if (config.SERVER_CMD == null) {
config.SERVER_CMD = "";
}
if (config.SSH_CMD == null) {
config.SSH_CMD = "";
}
if (config.PROTOCOL == null) {
config.PROTOCOL = "";
}
if (config.DIGEST_TYPE == null) {
config.DIGEST_TYPE = "";
}
if (config.HMAC_TYPE == null) {
config.HMAC_TYPE = "";
}

return config;
}
}
1 change: 0 additions & 1 deletion app/src/main/jni/Application.mk

This file was deleted.

0 comments on commit 34d3560

Please sign in to comment.