From fa27fe903604217325fdb6fc9cc67221b88fb8c7 Mon Sep 17 00:00:00 2001 From: Philipp Heckel Date: Sun, 27 Nov 2022 20:24:10 -0500 Subject: [PATCH] Avoid stack trace for empty icons --- app/src/main/java/io/heckel/ntfy/msg/NotificationParser.kt | 2 +- app/src/play/java/io/heckel/ntfy/firebase/FirebaseService.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/heckel/ntfy/msg/NotificationParser.kt b/app/src/main/java/io/heckel/ntfy/msg/NotificationParser.kt index 60b2e3a..81a60db 100644 --- a/app/src/main/java/io/heckel/ntfy/msg/NotificationParser.kt +++ b/app/src/main/java/io/heckel/ntfy/msg/NotificationParser.kt @@ -50,7 +50,7 @@ class NotificationParser { ) } } else null - val icon: Icon? = if (message.icon != null) Icon(url = message.icon) else null + val icon: Icon? = if (message.icon != null && message.icon != "") Icon(url = message.icon) else null val notification = Notification( id = message.id, subscriptionId = subscriptionId, diff --git a/app/src/play/java/io/heckel/ntfy/firebase/FirebaseService.kt b/app/src/play/java/io/heckel/ntfy/firebase/FirebaseService.kt index 8e200bc..1a367ab 100644 --- a/app/src/play/java/io/heckel/ntfy/firebase/FirebaseService.kt +++ b/app/src/play/java/io/heckel/ntfy/firebase/FirebaseService.kt @@ -124,7 +124,7 @@ class FirebaseService : FirebaseMessagingService() { url = attachmentUrl, ) } else null - val icon: Icon? = iconUrl?.let { Icon(url = it) } + val icon: Icon? = if (iconUrl != null && iconUrl != "") Icon(url = iconUrl) else null val notification = Notification( id = id, subscriptionId = subscription.id,