fix crash when controller file is broken
This commit is contained in:
parent
b21d9b2159
commit
269876d660
|
@ -5,6 +5,7 @@ import static com.tungsten.fclcore.fakefx.collections.FXCollections.observableAr
|
|||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.tungsten.fclauncher.utils.FCLPath;
|
||||
import com.tungsten.fclcore.fakefx.beans.Observable;
|
||||
|
@ -84,6 +85,8 @@ public class ButtonStyles {
|
|||
}
|
||||
} catch (IOException e) {
|
||||
Logging.LOG.log(Level.SEVERE, "Failed to get button styles", e);
|
||||
} catch (JsonSyntaxException e) {
|
||||
new File(FCLPath.CONTROLLER_DIR + "/styles/button_styles.json").delete();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import static com.tungsten.fclcore.fakefx.collections.FXCollections.observableAr
|
|||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.tungsten.fclauncher.utils.FCLPath;
|
||||
import com.tungsten.fclcore.fakefx.beans.Observable;
|
||||
|
@ -83,6 +84,8 @@ public class DirectionStyles {
|
|||
}
|
||||
} catch (IOException e) {
|
||||
Logging.LOG.log(Level.SEVERE, "Failed to get direction styles", e);
|
||||
} catch (JsonSyntaxException e) {
|
||||
new File(FCLPath.CONTROLLER_DIR + "/styles/direction_styles.json").delete();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import static com.tungsten.fcl.util.FXUtils.onInvalidating;
|
|||
import static com.tungsten.fclcore.fakefx.collections.FXCollections.observableArrayList;
|
||||
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import com.tungsten.fclauncher.utils.FCLPath;
|
||||
import com.tungsten.fclcore.fakefx.beans.Observable;
|
||||
import com.tungsten.fclcore.fakefx.beans.property.ReadOnlyListProperty;
|
||||
|
@ -113,6 +114,9 @@ public class Controllers {
|
|||
list.add(controller);
|
||||
} catch (IOException e) {
|
||||
Logging.LOG.log(Level.WARNING, "Can't read file: " + json.getAbsolutePath(), e.getMessage());
|
||||
} catch (JsonSyntaxException e) {
|
||||
Logging.LOG.log(Level.WARNING, "File: " + json.getAbsolutePath(), e.getMessage() + " is broken!");
|
||||
json.renameTo(new File(FCLPath.CONTROLLER_DIR, json.getName() + ".bak"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue