Fix tests

Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
alperozturk 2024-02-14 09:57:04 +01:00 committed by Alper Öztürk
parent 09baaa6e1b
commit cd54581320
2 changed files with 10 additions and 2 deletions

View file

@ -40,7 +40,11 @@ fun <T : Serializable?> Bundle?.getSerializableArgument(key: String, type: Class
this.getSerializable(key, type)
} else {
@Suppress("UNCHECKED_CAST", "DEPRECATION")
this.getSerializable(key) as T
if (type.isInstance(this.getSerializable(key))) {
this.getSerializable(key) as T
} else {
null
}
}
} catch (e: ClassCastException) {
Log_OC.e(tag, e.localizedMessage)

View file

@ -40,7 +40,11 @@ fun <T : Serializable?> Intent?.getSerializableArgument(key: String, type: Class
this.getSerializableExtra(key, type)
} else {
@Suppress("UNCHECKED_CAST", "DEPRECATION")
this.getSerializableExtra(key) as T
if (type.isInstance(this.getSerializableExtra(key))) {
this.getSerializableExtra(key) as T
} else {
null
}
}
} catch (e: ClassCastException) {
Log_OC.e(tag, e.localizedMessage)