[seahorse/feature/seahorse-pgp-key-api: 4/8] pgp-uid: Make sure parent is not null in constructor




commit 1d66c951fca0d2b32ba3059cbb7cbd2214f048f6
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Sun Aug 15 10:52:04 2021 +0200

    pgp-uid: Make sure parent is not null in constructor
    
    We will increasingly rely on this parent key (and the fact that it
    exists) so make sure nobody calls it with an invalid value.

 pgp/seahorse-pgp-uid.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/pgp/seahorse-pgp-uid.c b/pgp/seahorse-pgp-uid.c
index ab4b8718..3d86e866 100644
--- a/pgp/seahorse-pgp-uid.c
+++ b/pgp/seahorse-pgp-uid.c
@@ -341,11 +341,13 @@ seahorse_pgp_uid_class_init (SeahorsePgpUidClass *klass)
 
 SeahorsePgpUid *
 seahorse_pgp_uid_new (SeahorsePgpKey *parent,
-                      const gchar *uid_string)
+                      const char     *uid_string)
 {
-    g_autofree gchar *name = NULL;
-    g_autofree gchar *email = NULL;
-    g_autofree gchar *comment = NULL;
+    g_autofree char *name = NULL;
+    g_autofree char *email = NULL;
+    g_autofree char *comment = NULL;
+
+    g_return_val_if_fail (SEAHORSE_PGP_IS_KEY (parent), NULL);
 
     if (uid_string)
         parse_user_id (uid_string, &name, &email, &comment);


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