diff options
author | Harsh Shandilya <me@msfjarvis.dev> | 2020-03-28 02:35:01 +0530 |
---|---|---|
committer | Harsh Shandilya <me@msfjarvis.dev> | 2020-03-28 02:35:01 +0530 |
commit | 9fe008d40761b09de3d01b99d0c4418f92cd5604 (patch) | |
tree | 7d91bcced2f3b59442a600cdd5358d8a50033f54 /ui/src/main/java/com/wireguard | |
parent | e905c355f9dc4892445f1d954f62b84866913d43 (diff) |
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>
Diffstat (limited to 'ui/src/main/java/com/wireguard')
-rw-r--r-- | ui/src/main/java/com/wireguard/android/model/ObservableTunnel.kt | 4 |
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 |