|
@@ -72,7 +72,12 @@ public fun <T> MiraiFile.loadNotBlankAs(
|
|
if (!this.exists() || this.length == 0L) {
|
|
if (!this.exists() || this.length == 0L) {
|
|
return null
|
|
return null
|
|
}
|
|
}
|
|
- return stringFormat.decodeFromString(serializer, this.readText())
|
|
|
|
|
|
+ return try {
|
|
|
|
+ stringFormat.decodeFromString(serializer, this.readText())
|
|
|
|
+ } catch (e: Throwable) { //broken file
|
|
|
|
+ e.printStackTrace()
|
|
|
|
+ null
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
public fun <T> MiraiFile.loadNotBlankAs(
|
|
public fun <T> MiraiFile.loadNotBlankAs(
|
|
@@ -82,6 +87,10 @@ public fun <T> MiraiFile.loadNotBlankAs(
|
|
if (!this.exists() || this.length == 0L) {
|
|
if (!this.exists() || this.length == 0L) {
|
|
return null
|
|
return null
|
|
}
|
|
}
|
|
- return binaryFormat.decodeFromByteArray(serializer, this.readBytes())
|
|
|
|
|
|
+ return try {
|
|
|
|
+ binaryFormat.decodeFromByteArray(serializer, this.readBytes())
|
|
|
|
+ } catch (e: Throwable) { //broken file
|
|
|
|
+ e.printStackTrace()
|
|
|
|
+ null
|
|
|
|
+ }
|
|
}
|
|
}
|
|
-
|
|
|