Skip to content

Commit

Permalink
Use immutable location copy to avoid duplicate null check
Browse files Browse the repository at this point in the history
  • Loading branch information
hb0 committed Nov 2, 2023
1 parent c484a67 commit 46c8018
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/main/kotlin/de/cyface/uploader/DefaultUploader.kt
Original file line number Diff line number Diff line change
Expand Up @@ -374,15 +374,15 @@ class DefaultUploader(private val apiEndpoint: String) : Uploader {
val attributes: MutableMap<String, String> = HashMap()

// Location meta data
if (metaData.startLocation != null) {
attributes["startLocLat"] = metaData.startLocation!!.latitude.toString()
attributes["startLocLon"] = metaData.startLocation!!.longitude.toString()
attributes["startLocTS"] = metaData.startLocation!!.timestamp.toString()
metaData.startLocation?.let { startLocation ->
attributes["startLocLat"] = startLocation.latitude.toString()
attributes["startLocLon"] = startLocation.longitude.toString()
attributes["startLocTS"] = startLocation.timestamp.toString()
}
if (metaData.endLocation != null) {
attributes["endLocLat"] = metaData.endLocation!!.latitude.toString()
attributes["endLocLon"] = metaData.endLocation!!.longitude.toString()
attributes["endLocTS"] = metaData.endLocation!!.timestamp.toString()
metaData.endLocation?.let { endLocation ->
attributes["endLocLat"] = endLocation.latitude.toString()
attributes["endLocLon"] = endLocation.longitude.toString()
attributes["endLocTS"] = endLocation.timestamp.toString()
}
attributes["locationCount"] = metaData.locationCount.toString()

Expand Down

0 comments on commit 46c8018

Please sign in to comment.