File tree Expand file tree Collapse file tree
sentry/src/main/java/io/sentry/cache Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -339,19 +339,16 @@ private void writeCrashMarkerFile() {
339339 * #persistCurrentSession(Session)} can have put it there, writing the live session, so the stored
340340 * copy is at least as advanced as this envelope. Rotating and overwriting it would file a running
341341 * session as the previous one and roll back any unhandled error it has recorded since.
342+ *
343+ * <p>A null session id never matches, so sessions we cannot tell apart are rotated as before.
342344 */
343345 private boolean isLateDuplicateStart (
344346 final @ Nullable Session startingSession , final @ Nullable Session currentSession ) {
345- return startingSession != null
346- && currentSession != null
347- && hasSameSessionId (currentSession , startingSession );
348- }
349-
350- private boolean hasSameSessionId (
351- final @ NotNull Session firstSession , final @ NotNull Session secondSession ) {
352- return firstSession .getSessionId () != null
353- && secondSession .getSessionId () != null
354- && Objects .equals (firstSession .getSessionId (), secondSession .getSessionId ());
347+ if (startingSession == null || currentSession == null ) {
348+ return false ;
349+ }
350+ final @ Nullable String startingSessionId = startingSession .getSessionId ();
351+ return startingSessionId != null && startingSessionId .equals (currentSession .getSessionId ());
355352 }
356353
357354 private boolean writeEnvelopeToDisk (
You can’t perform that action at this time.
0 commit comments