mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-21 10:17:56 +00:00
Fix potential crash when parsing PreKeySyncJobData.
Honestly at this point I have no idea how this is happening. Maybe somehow getting old data that was empty but not null? A mystery for the ages.
This commit is contained in:
committed by
Cody Henthorne
parent
07cea1818e
commit
8f884fdd5c
@@ -295,10 +295,15 @@ class PreKeysSyncJob private constructor(
|
||||
|
||||
class Factory : Job.Factory<PreKeysSyncJob> {
|
||||
override fun create(parameters: Parameters, serializedData: ByteArray?): PreKeysSyncJob {
|
||||
return serializedData?.let {
|
||||
val data = PreKeysSyncJobData.ADAPTER.decode(serializedData)
|
||||
PreKeysSyncJob(parameters, data.forceRefreshRequested)
|
||||
} ?: PreKeysSyncJob(parameters, forceRotationRequested = false)
|
||||
return try {
|
||||
serializedData?.let {
|
||||
val data = PreKeysSyncJobData.ADAPTER.decode(serializedData)
|
||||
PreKeysSyncJob(parameters, data.forceRefreshRequested)
|
||||
} ?: PreKeysSyncJob(parameters, forceRotationRequested = false)
|
||||
} catch (e: IOException) {
|
||||
Log.w(TAG, "Error deserializing PreKeysSyncJob", e)
|
||||
PreKeysSyncJob(parameters, forceRotationRequested = false)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user