Fix not on FX thread
This commit is contained in:
@@ -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,15 +147,17 @@ public final class Profile implements Observable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void checkSelectedVersion() {
|
private void checkSelectedVersion() {
|
||||||
if (!repository.isLoaded()) return;
|
JFXUtilities.runInFX(() -> {
|
||||||
String newValue = selectedVersion.get();
|
if (!repository.isLoaded()) return;
|
||||||
if (!repository.hasVersion(newValue)) {
|
String newValue = selectedVersion.get();
|
||||||
Optional<String> version = repository.getVersions().stream().findFirst().map(Version::getId);
|
if (!repository.hasVersion(newValue)) {
|
||||||
if (version.isPresent())
|
Optional<String> version = repository.getVersions().stream().findFirst().map(Version::getId);
|
||||||
selectedVersion.setValue(version.get());
|
if (version.isPresent())
|
||||||
else if (newValue != null)
|
selectedVersion.setValue(version.get());
|
||||||
selectedVersion.setValue(null);
|
else if (newValue != null)
|
||||||
}
|
selectedVersion.setValue(null);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public HMCLGameRepository getRepository() {
|
public HMCLGameRepository getRepository() {
|
||||||
|
|||||||
Reference in New Issue
Block a user