Fix not on FX thread

This commit is contained in:
huanghongxun
2018-10-11 12:59:06 +08:00
parent 5eb7449b74
commit b4738f383b

View File

@@ -18,6 +18,7 @@
package org.jackhuang.hmcl.setting; package org.jackhuang.hmcl.setting;
import com.google.gson.*; import com.google.gson.*;
import com.jfoenix.concurrency.JFXUtilities;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.beans.InvalidationListener; import javafx.beans.InvalidationListener;
import javafx.beans.Observable; import javafx.beans.Observable;
@@ -146,6 +147,7 @@ public final class Profile implements Observable {
} }
private void checkSelectedVersion() { private void checkSelectedVersion() {
JFXUtilities.runInFX(() -> {
if (!repository.isLoaded()) return; if (!repository.isLoaded()) return;
String newValue = selectedVersion.get(); String newValue = selectedVersion.get();
if (!repository.hasVersion(newValue)) { if (!repository.hasVersion(newValue)) {
@@ -155,6 +157,7 @@ public final class Profile implements Observable {
else if (newValue != null) else if (newValue != null)
selectedVersion.setValue(null); selectedVersion.setValue(null);
} }
});
} }
public HMCLGameRepository getRepository() { public HMCLGameRepository getRepository() {