fix tests

This commit is contained in:
Milos Kozak 2019-11-19 20:43:42 +01:00
parent 3c025e97a8
commit bf6449f201
2 changed files with 8 additions and 7 deletions

View file

@ -75,9 +75,9 @@ public class ProfileStore {
if (store.has(profileName)) { if (store.has(profileName)) {
profile = cachedObjects.get(profileName); profile = cachedObjects.get(profileName);
if (profile == null) { if (profile == null) {
if (store.has("units")) { JSONObject profileObject = store.getJSONObject(profileName);
String units = store.getString("units"); if (profileObject!= null && profileObject.has("units")) {
profile = new Profile(store.getJSONObject(profileName), units); profile = new Profile(profileObject, profileObject.getString("units"));
cachedObjects.put(profileName, profile); cachedObjects.put(profileName, profile);
} }
} }

View file

@ -29,6 +29,11 @@ object LocalProfilePlugin : PluginBase(PluginDescription()
.shortName(R.string.localprofile_shortname) .shortName(R.string.localprofile_shortname)
.description(R.string.description_profile_local)), ProfileInterface { .description(R.string.description_profile_local)), ProfileInterface {
override fun onStart() {
super.onStart()
loadSettings()
}
private val log = LoggerFactory.getLogger(L.PROFILE) private val log = LoggerFactory.getLogger(L.PROFILE)
private var rawProfile: ProfileStore? = null private var rawProfile: ProfileStore? = null
@ -54,10 +59,6 @@ object LocalProfilePlugin : PluginBase(PluginDescription()
internal var numOfProfiles = 0 internal var numOfProfiles = 0
internal var currentProfileIndex = 0 internal var currentProfileIndex = 0
init {
loadSettings()
}
fun currentProfile() = profiles[currentProfileIndex] fun currentProfile() = profiles[currentProfileIndex]
@Synchronized @Synchronized