[libgweather] GWeatherLocation: check the location passed to serialize



commit a408d2f0939d4b4289d9990cd1ae24fdccca8b86
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Fri Feb 1 17:57:07 2013 +0100

    GWeatherLocation: check the location passed to serialize
    
    Only cities and weather stations can be serialized.

 libgweather/gweather-location.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/libgweather/gweather-location.c b/libgweather/gweather-location.c
index 8cfd6bf..1de6f67 100644
--- a/libgweather/gweather-location.c
+++ b/libgweather/gweather-location.c
@@ -1044,6 +1044,9 @@ gweather_location_format_one_deserialize (GWeatherLocation *world,
 GVariant *
 gweather_location_serialize (GWeatherLocation *location)
 {
+    g_return_val_if_fail (location != NULL, NULL);
+    g_return_val_if_fail (location->level >= GWEATHER_LOCATION_CITY, NULL);
+
     return g_variant_new ("(uv)", FORMAT,
 			  gweather_location_format_one_serialize (location));
 }



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