Better skin fix error handling

Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
TheKodeToad 2022-11-20 09:55:30 +00:00
parent ead59c0246
commit bfa5fe1598
2 changed files with 17 additions and 4 deletions

View File

@ -40,6 +40,7 @@ import java.util.List;
import org.prismlauncher.fix.skins.SkinFix;
import org.prismlauncher.utils.Parameters;
import org.prismlauncher.utils.logging.Log;
public final class Fixes {
@ -48,9 +49,15 @@ public final class Fixes {
public static void apply(Parameters params) {
List<String> fixes = params.getList("fixes", Collections.<String>emptyList());
for (Fix fix : FIXES)
if (fixes.contains(fix.getName()) && fix.isApplicable(params))
for (Fix fix : FIXES) {
if (fixes.contains(fix.getName()) && fix.isApplicable(params)) {
try {
fix.apply();
} catch (Throwable e) {
Log.error("Could not apply " + fix.getName(), e);
}
}
}
}
}

View File

@ -71,7 +71,13 @@ public final class SkinFix implements Fix, URLStreamHandlerFactory {
@Override
public void apply() {
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