Closes issue #9
All checks were successful
KnarCraft/Minecraft-Server-Launcher/pipeline/head This commit looks good

Adds a catch to prevent the software from crashing when checking for an update fails
This commit is contained in:
Kristian Knarvik 2021-08-17 19:42:18 +02:00
parent 8476c78589
commit c67f3bdd2c

View File

@ -21,7 +21,7 @@ import java.util.concurrent.TimeUnit;
* A software for managing Minecraft servers. * A software for managing Minecraft servers.
* *
* @author Kristian Knarvik <kristian.knarvik@knett.no> * @author Kristian Knarvik <kristian.knarvik@knett.no>
* @version 1.0.0 * @version b1.3.4
* @since 1.0.0 * @since 1.0.0
*/ */
@ -34,8 +34,14 @@ public class Main {
private static ServerLauncherGUI gui; private static ServerLauncherGUI gui;
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
Updater.checkForUpdate(updateURL, updateChannel); String logFile = Main.getApplicationWorkDirectory() + File.separator + "latestrun.log";
CommonFunctions.writeFile(Main.getApplicationWorkDirectory() + File.separator + "latestrun.log", ""); CommonFunctions.writeFile(logFile, "[Info]: Starting Minecraft Server Launcher v." +
Updater.getCurrentVersion()[1]);
try {
Updater.checkForUpdate(updateURL, updateChannel);
} catch (IOException e) {
CommonFunctions.appendFile(logFile, "[Warning]: Unable to complete update procedure: " + e.getMessage());
}
EventQueue.invokeLater(() -> { EventQueue.invokeLater(() -> {
try { try {
ServerConsoles.instantiate(); ServerConsoles.instantiate();