From 949e312a0f3b41b812b6f4ea60eccfd61b5641af Mon Sep 17 00:00:00 2001 From: ligi Date: Fri, 28 Oct 2016 15:21:04 +0200 Subject: [PATCH] Do the same but more the kotlin way --- .../org/ligi/passandroid/model/pass/PassLocation.kt | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/android/src/main/java/org/ligi/passandroid/model/pass/PassLocation.kt b/android/src/main/java/org/ligi/passandroid/model/pass/PassLocation.kt index 1ab7042d..080e2014 100644 --- a/android/src/main/java/org/ligi/passandroid/model/pass/PassLocation.kt +++ b/android/src/main/java/org/ligi/passandroid/model/pass/PassLocation.kt @@ -7,12 +7,10 @@ class PassLocation { var lat: Double = 0.toDouble() var lon: Double = 0.toDouble() - fun getNameWithFallback(pass: Pass): String? { - if (name == null || name!!.isEmpty()) { - // fallback for passes with locations without description - e.g. AirBerlin - return pass.description - } - return name + fun getNameWithFallback(pass: Pass) = if (name.isNullOrBlank()) { + // fallback for passes with locations without description - e.g. AirBerlin + pass.description + } else { + name } - }