[libnotify] notification: Warn if trying to get the activation token outside activation



commit adb3e0c7bf10f82541521d9ab617e42a44128c91
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Tue May 17 04:09:56 2022 +0200

    notification: Warn if trying to get the activation token outside activation
    
    This API is intended to be used only during a NotifyActionCallback, so
    ensure that this is the case, by warn in case it's not the case.

 libnotify/notification.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
---
diff --git a/libnotify/notification.c b/libnotify/notification.c
index de563d2..c8c7010 100644
--- a/libnotify/notification.c
+++ b/libnotify/notification.c
@@ -1694,11 +1694,9 @@ const char *
 notify_notification_get_activation_token (NotifyNotification *notification)
 {
         g_return_val_if_fail (NOTIFY_IS_NOTIFICATION (notification), NULL);
+        g_return_val_if_fail (notification->priv->activating, NULL);
 
-        if (notification->priv->activating)
-                return notification->priv->activation_token;
-
-        return NULL;
+        return notification->priv->activation_token;
 }
 
 gboolean


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]