From 80ca4e647a6ae9d4aa274338b1c8c84a2889450d Mon Sep 17 00:00:00 2001 From: Dennis Guse Date: Tue, 5 Apr 2022 20:20:35 +0200 Subject: [PATCH] Bug: crash earlier if in IntervalsFragment if the trackId is null. Belongs to #1156. --- .../opentracks/ui/intervals/IntervalsFragment.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/dennisguse/opentracks/ui/intervals/IntervalsFragment.java b/src/main/java/de/dennisguse/opentracks/ui/intervals/IntervalsFragment.java index 0e757cde4..485ad60e0 100644 --- a/src/main/java/de/dennisguse/opentracks/ui/intervals/IntervalsFragment.java +++ b/src/main/java/de/dennisguse/opentracks/ui/intervals/IntervalsFragment.java @@ -16,6 +16,7 @@ import androidx.lifecycle.ViewModelProvider; import androidx.recyclerview.widget.LinearLayoutManager; import java.util.List; +import java.util.Objects; import de.dennisguse.opentracks.R; import de.dennisguse.opentracks.data.ContentProviderUtils; @@ -59,10 +60,11 @@ public class IntervalsFragment extends Fragment { /** * Creates an instance of this class. * - * @param fromTopToBottom If true then the intervals are shown from top to bottom (the first interval on top). Otherwise the intervals are shown from bottom to top. + * @param fromTopToBottom If true then the intervals are shown from top to bottom (the first interval on top). Otherwise the intervals are shown from bottom to top. * @return IntervalsFragment instance. */ - public static Fragment newInstance(Track.Id trackId, boolean fromTopToBottom) { + public static Fragment newInstance(@NonNull Track.Id trackId, boolean fromTopToBottom) { + Objects.nonNull(trackId); Bundle bundle = new Bundle(); bundle.putBoolean(FROM_TOP_TO_BOTTOM_KEY, fromTopToBottom); bundle.putParcelable(TRACK_ID_KEY, trackId);