`termux-notification-list` fails to execute sometimes
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 4.3k
- Forks
- 920
- PR merge metrics
- No merged PRs in 30d
Description
Can't reproduce, seems to happen randomly.
NotificationService.get() is returning null sometimes?
https://github.com/termux/termux-api/blob/4159c62dd6cd9a8793465def769686fc7ac99fe2/app/src/main/java/com/termux/api/apis/NotificationListAPI.java#L36-L37
Error
Error in ResultReturner:
java.lang.NullPointerException: Attempt to invoke virtual method 'android.service.notification.StatusBarNotification[] com.termux.api.apis.NotificationListAPI$NotificationService.getActiveNotifications()' on a null object reference
at com.termux.api.apis.NotificationListAPI.listNotifications(NotificationListAPI.java:37)
at com.termux.api.apis.NotificationListAPI$1.writeJson(NotificationListAPI.java:29)
at com.termux.api.util.ResultReturner$ResultJsonWriter.writeResult(ResultReturner.java:122)
at com.termux.api.util.ResultReturner.lambda$returnData$0(ResultReturner.java:179)
at com.termux.api.util.ResultReturner$$ExternalSyntheticLambda0.run(Unknown Source:8)
at java.lang.Thread.run(Thread.java:1012)
Termux
VERSION_NAME: 0.118.0+9d308c2
VERSION_CODE: 118
APK_RELEASE: Github
Termux:API
VERSION_NAME: 0.50.1+4a711e9
VERSION_CODE: 51
APK_RELEASE: Github
APT_PACKAGE_VERSION: 0.58.0-1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in app/src/main/java/com/termux/api/apis/NotificationListAPI.java, especially lines 29 and 36-37 named in the stack trace, and inspect when NotificationService.get() can return null. Run termux-notification-list under the affected conditions; done means it no longer throws this NullPointerException and returns the notification list or an appropriate result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- api, cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100