Skip to content

Commit e4110bc

Browse files
committed
Make trace nullable when stopping tracing
1 parent 78a496f commit e4110bc

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

app/src/org/commcare/google/services/analytics/CCPerfMonitoring.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,23 @@ object CCPerfMonitoring {
4242
return null
4343
}
4444

45-
fun stopTracing(trace: Trace, attrs: MutableMap<String, String>?) {
45+
fun stopTracing(trace: Trace?, attrs: MutableMap<String, String>?) {
4646
try {
47-
attrs?.forEach { (key, value) -> trace.putAttribute(key, value) }
48-
trace.stop()
47+
attrs?.forEach { (key, value) -> trace?.putAttribute(key, value) }
48+
trace?.stop()
4949
} catch (exception: Exception) {
50-
Logger.exception("Error stopping perf trace: ${trace.name}", exception)
50+
Logger.exception("Error stopping perf trace: ${trace?.name}", exception)
5151
}
5252
}
5353

54-
fun stopFileEncryptionTracing(trace: Trace, fileSizeBytes: Long, fileName: String) {
54+
fun stopFileEncryptionTracing(trace: Trace?, fileSizeBytes: Long, fileName: String) {
5555
try {
5656
val attrs: MutableMap<String, String> = HashMap()
5757
attrs[ATTR_FILE_SIZE_BYTES] = fileSizeBytes.toString()
5858
attrs[ATTR_FILE_TYPE] = FilenameUtils.getExtension(fileName)
5959
stopTracing(trace, attrs)
6060
} catch (e: java.lang.Exception) {
61-
Logger.exception("Failed to stop tracing: ${trace.name}", e)
61+
Logger.exception("Failed to stop tracing: ${trace?.name}", e)
6262
}
6363
}
6464

0 commit comments

Comments
 (0)