[discident-glib] ean: Add minimal guards against bad parameters



commit db0f3300fc23137b110f7bd10dded542ba55de5b
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Dec 21 17:30:57 2015 +0100

    ean: Add minimal guards against bad parameters
    
    To catch the worst offenders. The whole API should be checked and fixed
    though.

 discident-glib/discident-ean-glib.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/discident-glib/discident-ean-glib.c b/discident-glib/discident-ean-glib.c
index 03f713a..5c24fa9 100644
--- a/discident-glib/discident-ean-glib.c
+++ b/discident-glib/discident-ean-glib.c
@@ -217,6 +217,9 @@ discident_ean_lookup_sync (DiscidentEan *ean,
                           char        **img_url,
                           GError      **error)
 {
+       g_return_val_if_fail (ean->priv->service != NULL, FALSE);
+       g_return_val_if_fail (barcode != NULL, FALSE);
+
        if (img_url)
                *img_url = NULL;
        if (title)


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