termux-api icon indicating copy to clipboard operation
termux-api copied to clipboard

`termux-notification-list` fails to execute sometimes

Open nozwock opened this issue 1 year ago • 0 comments

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

nozwock avatar Feb 28 '24 13:02 nozwock