[libchamplain] Return NULL from all factory functions if the map source with the given name doesn't exist
- From: Jiří Techet <jiritechet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libchamplain] Return NULL from all factory functions if the map source with the given name doesn't exist
- Date: Wed, 13 Jul 2016 18:27:35 +0000 (UTC)
commit ecc7f497c0b0532d1daf25645c040837d4bfa930
Author: Jiří Techet <techet gmail com>
Date: Wed Jul 13 20:22:11 2016 +0200
Return NULL from all factory functions if the map source with the given name doesn't exist
champlain/champlain-map-source-factory.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/champlain/champlain-map-source-factory.c b/champlain/champlain-map-source-factory.c
index 234d3cc..8efaa89 100644
--- a/champlain/champlain-map-source-factory.c
+++ b/champlain/champlain-map-source-factory.c
@@ -408,8 +408,8 @@ champlain_map_source_factory_get_registered (ChamplainMapSourceFactory *factory)
* Note: The id should not contain any character that can't be in a filename as it
* will be used as the cache directory name for that map source.
*
- * Returns: (transfer none): a ready to use #ChamplainMapSource matching the given name, returns
- * NULL is none match.
+ * Returns: (transfer none): a ready to use #ChamplainMapSource matching the given name;
+ * returns NULL if the source with the given name doesn't exist.
*
* Since: 0.4
*/
@@ -448,6 +448,7 @@ champlain_map_source_factory_create (ChamplainMapSourceFactory *factory,
* Returns: (transfer none): a ready to use #ChamplainMapSourceChain consisting of
* #ChamplainMemoryCache, #ChamplainFileCache, #ChamplainMapSource matching the given name, and
* an error tile source created with champlain_map_source_factory_create_error_source ().
+ * Returns NULL if the source with the given name doesn't exist.
*
* Since: 0.6
*/
@@ -464,6 +465,8 @@ champlain_map_source_factory_create_cached_source (ChamplainMapSourceFactory *fa
ChamplainRenderer *renderer;
tile_source = champlain_map_source_factory_create (factory, id);
+ if (!tile_source)
+ return NULL;
tile_size = champlain_map_source_get_tile_size (tile_source);
error_source = champlain_map_source_factory_create_error_source (factory, tile_size);
@@ -492,7 +495,8 @@ champlain_map_source_factory_create_cached_source (ChamplainMapSourceFactory *fa
* Creates a memory cached map source.
*
* Returns: (transfer none): a ready to use #ChamplainMapSourceChain consisting of
- * #ChamplainMemoryCache and #ChamplainMapSource matching the given name
+ * #ChamplainMemoryCache and #ChamplainMapSource matching the given name.
+ * Returns NULL if the source with the given name doesn't exist.
*
* Since: 0.12.5
*/
@@ -506,6 +510,8 @@ champlain_map_source_factory_create_memcached_source (ChamplainMapSourceFactory
ChamplainRenderer *renderer;
tile_source = champlain_map_source_factory_create (factory, id);
+ if (!tile_source)
+ return NULL;
renderer = CHAMPLAIN_RENDERER (champlain_image_renderer_new ());
memory_cache = CHAMPLAIN_MAP_SOURCE (champlain_memory_cache_new_full (100, renderer));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]