aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2020-03-28 02:35:01 +0530
committerHarsh Shandilya <me@msfjarvis.dev>2020-03-28 02:35:01 +0530
commit5caf689d1762cc5969d6da0df8284641b04f844a (patch)
tree7d91bcced2f3b59442a600cdd5358d8a50033f54
parentREADME: mention docs location (diff)
downloadwireguard-android-5caf689d1762cc5969d6da0df8284641b04f844a.tar.xz
wireguard-android-5caf689d1762cc5969d6da0df8284641b04f844a.zip
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 <me@msfjarvis.dev>
-rw-r--r--ui/src/main/java/com/wireguard/android/model/ObservableTunnel.kt4
1 files changed, 2 insertions, 2 deletions
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