Skip to content

Commit d5748e2

Browse files
Fix null parse (#1242)
1 parent 3812f8b commit d5748e2

File tree

4 files changed

+16
-14
lines changed

4 files changed

+16
-14
lines changed

Branch-SDK-TestBed/src/main/java/io/branch/branchandroidtestbed/CustomBranchApp.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ public final class CustomBranchApp extends Application {
1717
public void onCreate() {
1818
super.onCreate();
1919

20-
IBranchLoggingCallbacks loggingCallbacks = (message, tag) -> {
21-
Log.d("BranchTestbed", message);
22-
saveLogToFile(message);
23-
};
24-
Branch.enableLogging(loggingCallbacks);
20+
// IBranchLoggingCallbacks loggingCallbacks = (message, tag) -> {
21+
// Log.d("BranchTestbed", message);
22+
// saveLogToFile(message);
23+
// };
24+
Branch.enableLogging(BranchLogger.BranchLogLevel.VERBOSE);
2525

2626
Branch.getAutoInstance(this);
2727
}
@@ -44,6 +44,4 @@ private void saveLogToFile(String logMessage) {
4444
Log.e("BranchTestbed", "Error writing to log file", e);
4545
}
4646
}
47-
48-
4947
}

Branch-SDK-TestBed/src/main/java/io/branch/branchandroidtestbed/MainActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ protected void onStart() {
714714
// Please look for "BranchSDK_Doctor" in the logcat to see the results.
715715
// IMP : Do not make this call in your production app
716716

717-
IntegrationValidator.validate(MainActivity.this);
717+
//IntegrationValidator.validate(MainActivity.this);
718718
}
719719

720720

Branch-SDK/src/main/java/io/branch/referral/Branch.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ synchronized public static Branch getAutoInstance(@NonNull Context context) {
381381

382382
BranchUtil.setFbAppIdFromConfig(context);
383383

384-
BranchUtil.setCPPLevel(context);
384+
BranchUtil.setCPPLevelFromConfig(context);
385385

386386
BranchUtil.setTestMode(BranchUtil.checkTestMode(context));
387387
branchReferral_ = initBranchSDK(context, BranchUtil.readBranchKey(context));
@@ -412,7 +412,7 @@ public static Branch getAutoInstance(@NonNull Context context, @NonNull String b
412412

413413
BranchUtil.setAPIBaseUrlFromConfig(context);
414414
BranchUtil.setFbAppIdFromConfig(context);
415-
BranchUtil.setCPPLevel(context);
415+
BranchUtil.setCPPLevelFromConfig(context);
416416
BranchUtil.setTestMode(BranchUtil.checkTestMode(context));
417417
// If a Branch key is passed already use it. Else read the key
418418
if (!isValidBranchKey(branchKey)) {

Branch-SDK/src/main/java/io/branch/referral/BranchUtil.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import java.io.IOException;
2121
import java.io.InputStream;
2222
import java.util.Iterator;
23-
import java.util.Objects;
2423
import java.util.jar.JarFile;
2524

2625
/**
@@ -156,10 +155,15 @@ public static void setFbAppIdFromConfig(Context context) {
156155
}
157156
}
158157

159-
public static void setCPPLevel(Context context) {
158+
public static void setCPPLevelFromConfig(Context context) {
160159
BranchJsonConfig jsonConfig = BranchJsonConfig.getInstance(context);
161-
Defines.BranchAttributionLevel cppLevel = Defines.BranchAttributionLevel.valueOf(jsonConfig.getConsumerProtectionAttributionLevel());
162-
Branch.getInstance().setConsumerProtectionAttributionLevel(cppLevel);
160+
String jsonString = jsonConfig.getConsumerProtectionAttributionLevel();
161+
162+
// If there is no entry, do not change the setting or any default behavior.
163+
if(!TextUtils.isEmpty(jsonString)) {
164+
Defines.BranchAttributionLevel cppLevel = Defines.BranchAttributionLevel.valueOf(jsonString);
165+
Branch.getInstance().setConsumerProtectionAttributionLevel(cppLevel);
166+
}
163167
}
164168

165169
/**

0 commit comments

Comments
 (0)