android / android/platform-samples
[Bug]: NullPointerException in androidx.core.telecom.internal.PreCallEndpointsUpdater.updateClient when sorting endpoints
- Dominant language
- Kotlin
- Stars
- 1.7k
- Forks
- 541
- Avg merge
- 7d 23h
- Merged PRs (30d)
- 3
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### In which area is the issue?
Connectivity
### In a specific sample?
_No response_
### What happened?
Fatal Exception: java.lang.NullPointerException
Attempt to invoke interface method 'int java.lang.Comparable.compareTo(java.lang.Object)' on a null object reference
java.util.ComparableTimSort.binarySort (ComparableTimSort.java:262)
java.util.ComparableTimSort.sort (ComparableTimSort.java:189)
java.util.Arrays.sort (Arrays.java:1061)
kotlin.collections.ArraysKt___ArraysJvmKt.sort (ArraysKt___ArraysJvm.kt:2085)
kotlin.collections.CollectionsKt___CollectionsKt.sorted (CollectionsKt___Collections.kt:1040)
androidx.core.telecom.internal.PreCallEndpointsUpdater.updateClient$core_telecom_release (PreCallEndpointsUpdater.kt:132)
androidx.core.telecom.internal.PreCallEndpointsUpdater.endpointsRemovedUpdate (PreCallEndpointsUpdater.kt:80)
androidx.core.telecom.internal.AudioDeviceListener.onAudioDevicesRemoved (AudioDeviceListener.kt:67)
### Relevant logcat output
```shell
Fatal Exception: java.lang.NullPointerException
Attempt to invoke interface method 'int java.lang.Comparable.compareTo(java.lang.Object)' on a null object reference
java.util.ComparableTimSort.binarySort (ComparableTimSort.java:262)
java.util.ComparableTimSort.sort (ComparableTimSort.java:189)
java.util.Arrays.sort (Arrays.java:1061)
kotlin.collections.ArraysKt___ArraysJvmKt.sort (ArraysKt___ArraysJvm.kt:2085)
kotlin.collections.CollectionsKt___CollectionsKt.sorted (CollectionsKt___Collections.kt:1040)
androidx.core.telecom.internal.PreCallEndpointsUpdater.updateClient$core_telecom_release (PreCallEndpointsUpdater.kt:132)
androidx.core.telecom.internal.PreCallEndpointsUpdater.endpointsRemovedUpdate (PreCallEndpointsUpdater.kt:80)
androidx.core.telecom.internal.AudioDeviceListener.onAudioDevicesRemoved (AudioDeviceListener.kt:67)
android.media.AudioManager$NativeEventHandlerDelegate$1.handleMessage (AudioManager.java:10938)
android.os.Handler.dispatchMessage (Handler.java:107)
android.os.Looper.loopOnce (Looper.java:282)
android.os.Looper.loop (Looper.java:387)
android.app.ActivityThread.main (ActivityThread.java:9500)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:600)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1005)
```
### Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Contributor guide
Research direction
Start in androidx.core.telecom.internal.PreCallEndpointsUpdater.kt at lines 80 and 132, then trace the call from AudioDeviceListener.onAudioDevicesRemoved in AudioDeviceListener.kt. Reproduce or inspect the endpoint-removal path to identify which value reaches sorted as null. Done means this path no longer throws the reported NullPointerException when endpoints are removed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 45/100