Skip to content

Commit 9aa29af

Browse files
committed
🐛 Fix a bug where the app crashes in Android whenever setPrimaryColor and setFloatingEdge and setFloatingButtonOffsetFromTop are not called.
1 parent 66aa6e3 commit 9aa29af

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativePackage.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class RNInstabugReactnativePackage implements ReactPackage {
3535

3636
public RNInstabugReactnativePackage(String androidApplicationToken, Application androidApplication,
3737
String[] invocationEventValues, String primaryColor,
38-
InstabugFloatingButtonEdge floatingButtonEdge, int offset) {
38+
InstabugFloatingButtonEdge floatingButtonEdge, Integer offset) {
3939
this.androidApplication = androidApplication;
4040
this.mAndroidApplicationToken = androidApplicationToken;
4141

@@ -48,9 +48,12 @@ public RNInstabugReactnativePackage(String androidApplicationToken, Application
4848
.setReproStepsState(State.DISABLED)
4949
.build();
5050

51-
Instabug.setPrimaryColor(Color.parseColor(primaryColor));
52-
BugReporting.setFloatingButtonEdge(floatingButtonEdge);
53-
BugReporting.setFloatingButtonOffset(offset);
51+
if(primaryColor != null)
52+
Instabug.setPrimaryColor(Color.parseColor(primaryColor));
53+
if(floatingButtonEdge != null)
54+
BugReporting.setFloatingButtonEdge(floatingButtonEdge);
55+
if(offset != null)
56+
BugReporting.setFloatingButtonOffset(offset);
5457

5558
}
5659

0 commit comments

Comments
 (0)