Commit b9cb3438 authored by Daniel Wolf's avatar Daniel Wolf
Browse files

Use default for unparseable server configs

parent b8ea717f
......@@ -12,6 +12,7 @@ import com.frostnerd.preferenceskt.typedpreferences.TypedPreferences
import com.frostnerd.preferenceskt.typedpreferences.types.PreferenceType
import com.frostnerd.smokescreen.type
import com.frostnerd.smokescreen.util.ServerType
import java.lang.NullPointerException
import kotlin.reflect.KProperty
/*
......@@ -46,7 +47,8 @@ class DnsServerInformationPreference(key: String) :
thisRef: TypedPreferences<SharedPreferences>,
property: KProperty<*>
): DnsServerInformation<*>? {
return if(thisRef.sharedPreferences.contains(key + "_type")) {
return try{
if(thisRef.sharedPreferences.contains(key + "_type")) {
val type = thisRef.sharedPreferences.getString(key + "_type", "")
val json = thisRef.sharedPreferences.getString(key, "")
if(json.isNullOrBlank()) {
......@@ -60,6 +62,9 @@ class DnsServerInformationPreference(key: String) :
}
}
} else null
} catch (err:Throwable){
null
}
}
override fun setValue(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment