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>
This commit is contained in:
Harsh Shandilya 2020-03-28 02:35:01 +05:30
parent e905c355f9
commit 9fe008d407

View File

@ -65,9 +65,9 @@ class ObservableTunnel internal constructor(
@get:Bindable @get:Bindable
var config = config var config = config
get() { get() {
if (config == null) if (field == null)
manager.getTunnelConfig(this).whenComplete(ExceptionLoggers.E) manager.getTunnelConfig(this).whenComplete(ExceptionLoggers.E)
return config return field
} }
private set private set