Better skin fix error handling
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
parent
ead59c0246
commit
bfa5fe1598
@ -40,6 +40,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.prismlauncher.fix.skins.SkinFix;
|
import org.prismlauncher.fix.skins.SkinFix;
|
||||||
import org.prismlauncher.utils.Parameters;
|
import org.prismlauncher.utils.Parameters;
|
||||||
|
import org.prismlauncher.utils.logging.Log;
|
||||||
|
|
||||||
public final class Fixes {
|
public final class Fixes {
|
||||||
|
|
||||||
@ -48,9 +49,15 @@ public final class Fixes {
|
|||||||
public static void apply(Parameters params) {
|
public static void apply(Parameters params) {
|
||||||
List<String> fixes = params.getList("fixes", Collections.<String>emptyList());
|
List<String> fixes = params.getList("fixes", Collections.<String>emptyList());
|
||||||
|
|
||||||
for (Fix fix : FIXES)
|
for (Fix fix : FIXES) {
|
||||||
if (fixes.contains(fix.getName()) && fix.isApplicable(params))
|
if (fixes.contains(fix.getName()) && fix.isApplicable(params)) {
|
||||||
fix.apply();
|
try {
|
||||||
|
fix.apply();
|
||||||
|
} catch (Throwable e) {
|
||||||
|
Log.error("Could not apply " + fix.getName(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,13 @@ public final class SkinFix implements Fix, URLStreamHandlerFactory {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void apply() {
|
public void apply() {
|
||||||
URL.setURLStreamHandlerFactory(this);
|
try {
|
||||||
|
URL.setURLStreamHandlerFactory(this);
|
||||||
|
} catch (Error e) {
|
||||||
|
Log.warning("Cannot apply skin fix");
|
||||||
|
Log.warning("URLStreamHandlerFactory is already set");
|
||||||
|
Log.warning("Turning off legacy skin fix in Settings > Miscellaneous will silence the warnings");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user