Fix args can be null

This commit is contained in:
Mygod
2020-05-31 02:57:20 +08:00
parent e8fb62a0b3
commit 3327242c2e
2 changed files with 20 additions and 19 deletions

View File

@@ -92,7 +92,7 @@ object WifiP2pManagerHelper {
val proxy = Proxy.newProxyInstance(interfacePersistentGroupInfoListener.classLoader,
arrayOf(interfacePersistentGroupInfoListener)) { proxy, method, args ->
if (method.name == "onPersistentGroupInfoAvailable") {
if (args.size != 1) Timber.w(IllegalArgumentException("Unexpected args: $args"))
if (args?.size != 1) Timber.w(IllegalArgumentException("Unexpected args: $args"))
@Suppress("UNCHECKED_CAST")
listener(getGroupList.invoke(args[0]) as Collection<WifiP2pGroup>)
null