Skip to content

Commit

Permalink
fix(capture-sdk) Fix a crash with lateinit value
Browse files Browse the repository at this point in the history
PP-689
  • Loading branch information
jackkray committed Aug 9, 2024
1 parent 94b8103 commit 509ac29
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ internal class BufferedUserAnalyticsEventTracker(
private val userProperties: Queue<Set<UserAnalyticsUserProperty>> = LinkedList()
private val events: Queue<Pair<UserAnalyticsEvent, Set<UserAnalyticsEventProperty>>> =
LinkedList()
private lateinit var amplitude: AmplitudeUserAnalyticsEventTracker
private var amplitude: AmplitudeUserAnalyticsEventTracker? = null

fun setPlatformTokens(
vararg tokens: UserAnalytics.AnalyticsApiKey,
Expand All @@ -46,8 +46,8 @@ internal class BufferedUserAnalyticsEventTracker(
networkRequestsManager = networkRequestsManager,
uniqueIdProvider = uniqueIdProvider
)
amplitude.startRepeatingJob()
eventTrackers.add(amplitude)
amplitude?.startRepeatingJob()
amplitude?.let { eventTrackers.add(it) }

LOG.debug("Amplitude Initialized")
}
Expand Down Expand Up @@ -90,7 +90,7 @@ internal class BufferedUserAnalyticsEventTracker(
}

override fun flushEvents() {
amplitude.flushEvents()
amplitude?.flushEvents()
}

private fun trySendEvents() {
Expand Down

0 comments on commit 509ac29

Please sign in to comment.