don't crash on unparseable date (#3129)
This commit is contained in:
parent
59fb710f64
commit
95631069b8
1 changed files with 8 additions and 1 deletions
|
@ -16,6 +16,8 @@
|
|||
*/
|
||||
package com.keylesspalace.tusky.json
|
||||
|
||||
import android.util.Log
|
||||
import com.google.gson.JsonParseException
|
||||
import com.google.gson.TypeAdapter
|
||||
import com.google.gson.stream.JsonReader
|
||||
import com.google.gson.stream.JsonToken
|
||||
|
@ -42,7 +44,12 @@ class Rfc3339DateJsonAdapter : TypeAdapter<Date?>() {
|
|||
null
|
||||
}
|
||||
else -> {
|
||||
reader.nextString().parseIsoDate()
|
||||
try {
|
||||
reader.nextString().parseIsoDate()
|
||||
} catch (jpe: JsonParseException) {
|
||||
Log.w("Rfc3339DateJsonAdapter", jpe)
|
||||
null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue