Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Corrupt config files not resetting to default state #2055

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class ConfigManager {
private fun firstLoadFile(file: File?, fileType: ConfigFileType, defaultValue: Any): Any {
val fileName = fileType.fileName
logger.log("Trying to load $fileName from $file")
var output: Any = defaultValue
var output: Any? = defaultValue

if (file!!.exists()) {
try {
Expand Down Expand Up @@ -203,6 +203,10 @@ class ConfigManager {
if (output == defaultValue) {
logger.log("Setting $fileName to be blank as it did not exist. It will be saved once something is written to it")
}
if (output == null) {
hannibal002 marked this conversation as resolved.
Show resolved Hide resolved
logger.log("Setting $fileName to be blank as it was null. It will be saved once something is written to it")
output = defaultValue
}

return output
}
Expand Down
Loading