From 9fe008d40761b09de3d01b99d0c4418f92cd5604 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sat, 28 Mar 2020 02:35:01 +0530 Subject: ObservableTunnel: Don't recurse in getConfig The correct way to retrieve the value inside a getter/setter is to use `field` to ensure you don't invoke the getter while inside the getter and trigger a stack overflow Signed-off-by: Harsh Shandilya --- ui/src/main/java/com/wireguard/android/model/ObservableTunnel.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ui/src/main/java/com/wireguard/android') diff --git a/ui/src/main/java/com/wireguard/android/model/ObservableTunnel.kt b/ui/src/main/java/com/wireguard/android/model/ObservableTunnel.kt index 457f50e7..00cbc5a0 100644 --- a/ui/src/main/java/com/wireguard/android/model/ObservableTunnel.kt +++ b/ui/src/main/java/com/wireguard/android/model/ObservableTunnel.kt @@ -65,9 +65,9 @@ class ObservableTunnel internal constructor( @get:Bindable var config = config get() { - if (config == null) + if (field == null) manager.getTunnelConfig(this).whenComplete(ExceptionLoggers.E) - return config + return field } private set -- cgit v1.2.3