Skip to content

Commit f2f3db3

Browse files
committed
Add null check for withSessionEndFields
1 parent 8d54a9c commit f2f3db3

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

firebase-crashlytics/src/main/java/com/google/firebase/crashlytics/internal/model/CrashlyticsReport.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,11 @@ public CrashlyticsReport withNdkPayload(@NonNull FilesPayload filesPayload) {
164164
@NonNull
165165
public CrashlyticsReport withSessionEndFields(
166166
long endedAt, boolean isCrashed, @Nullable String userId) {
167-
return toBuilder()
168-
.setSession(getSession().withSessionEndFields(endedAt, isCrashed, userId))
169-
.build();
167+
final Builder builder = toBuilder();
168+
if (getSession() != null) {
169+
builder.setSession(getSession().withSessionEndFields(endedAt, isCrashed, userId));
170+
}
171+
return builder.build();
170172
}
171173

172174
@AutoValue

0 commit comments

Comments
 (0)