From c9b813a2c8fcd53543c7aa84a773915d2c7c07d1 Mon Sep 17 00:00:00 2001 From: pacien Date: Tue, 25 Sep 2018 22:37:01 +0200 Subject: Properly handle null list --- .../status/networkinfo/VpnInterfaceConfigurationFormatter.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/src/main/java/org/pacien/tincapp/activities/status/networkinfo/VpnInterfaceConfigurationFormatter.kt b/app/src/main/java/org/pacien/tincapp/activities/status/networkinfo/VpnInterfaceConfigurationFormatter.kt index 568714e..2956cb4 100644 --- a/app/src/main/java/org/pacien/tincapp/activities/status/networkinfo/VpnInterfaceConfigurationFormatter.kt +++ b/app/src/main/java/org/pacien/tincapp/activities/status/networkinfo/VpnInterfaceConfigurationFormatter.kt @@ -28,8 +28,8 @@ import org.pacien.tincapp.data.CidrAddress object VpnInterfaceConfigurationFormatter { private val resources by lazy { App.getResources() } - fun formatList(list: List) = when { - list.isNotEmpty() -> list.joinToString("\n", transform = this::formatListElement) + fun formatList(list: List?) = when { + list != null && list.isNotEmpty() -> list.joinToString("\n", transform = this::formatListElement) else -> resources.getString(R.string.status_network_info_value_none)!! } -- cgit v1.2.3