File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
app/src/main/java/com/hippo/ehviewer/updater Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,11 @@ class AppUpdater(private val name: String, source: BufferedSource) {
4040
4141
4242 init {
43- val jsonObject = JSONObject .parseObject(source.readUtf8())
43+ val jsonObject: JSONObject = try {
44+ JSONObject .parseObject(source.readUtf8())
45+ } catch (e: JSONException ) {
46+ JSONObject ()
47+ }
4448 updateData = jsonObject
4549 }
4650
@@ -129,7 +133,7 @@ class AppUpdater(private val name: String, source: BufferedSource) {
129133 // Save new json data
130134 val tempDataFile = File (dir, " $dataName .tmp" )
131135 if (! save(client, dataUrl, tempDataFile)) {
132- if (manualChecking){
136+ if (manualChecking) {
133137 UpdateDialog (activity).showCheckFailDialog()
134138 }
135139 FileUtils .delete(tempDataFile)
@@ -154,9 +158,10 @@ class AppUpdater(private val name: String, source: BufferedSource) {
154158
155159 if (! needUpdate) {
156160 FileUtils .delete(tempDataFile)
157- if (manualChecking){
161+ if (manualChecking) {
158162 ContextCompat .getMainExecutor(activity).execute {
159- Toast .makeText(activity,R .string.update_to_date,Toast .LENGTH_LONG ).show()
163+ Toast .makeText(activity, R .string.update_to_date, Toast .LENGTH_LONG )
164+ .show()
160165 }
161166 }
162167 return @execute
You can’t perform that action at this time.
0 commit comments