Fixes #488: LeakCanary crash
parent
2e525813f6
commit
ff96362551
|
@ -33,11 +33,11 @@ class DebugFenixApplication : FenixApplication() {
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class ToggleableHeapDumper(
|
internal class ToggleableHeapDumper(
|
||||||
private val context: Context,
|
context: Context,
|
||||||
private val defaultDumper: HeapDumper
|
private val defaultDumper: HeapDumper
|
||||||
) : HeapDumper {
|
) : HeapDumper {
|
||||||
var prefs: SharedPreferences? = PreferenceManager.getDefaultSharedPreferences(context)
|
var prefs: SharedPreferences? = PreferenceManager.getDefaultSharedPreferences(context)
|
||||||
var enabled = prefs?.getBoolean(context.getPreferenceKey(pref_key_leakcanary), true) ?: true
|
var enabled = prefs?.getBoolean(context.getPreferenceKey(pref_key_leakcanary), true) ?: true
|
||||||
override fun dumpHeap(): File = if (enabled) defaultDumper.dumpHeap() else HeapDumper.RETRY_LATER
|
override fun dumpHeap(): File? = if (enabled) defaultDumper.dumpHeap() else HeapDumper.RETRY_LATER
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue