Skip to content

Commit a8bff7d

Browse files
authored
improvement: check for SentryTracer type in TTID (#2497)
* fix * update * update CHANGELOG
1 parent 7b4ce83 commit a8bff7d

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
## Unreleased
44

5+
### Improvements
6+
7+
- Check for type before casting in TTID ([#2497](https://github.com/getsentry/sentry-dart/pull/2497))
58

69
### Fixes
710

flutter/lib/src/navigation/time_to_initial_display_tracker.dart

+4-2
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,13 @@ class TimeToInitialDisplayTracker {
5151
final _endTimestamp = endTimestamp ?? await determineEndTime();
5252
if (_endTimestamp == null) return;
5353

54-
final tracer = transaction as SentryTracer;
54+
if (transaction is! SentryTracer) {
55+
return;
56+
}
5557

5658
final ttidSpan = transaction.startChild(
5759
SentrySpanOperations.uiTimeToInitialDisplay,
58-
description: '${tracer.name} initial display',
60+
description: '${transaction.name} initial display',
5961
startTimestamp: startTimestamp,
6062
);
6163

0 commit comments

Comments
 (0)