From 6502f2520367a13b45479e9313c462e41d962220 Mon Sep 17 00:00:00 2001 From: Varun Date: Wed, 21 Sep 2016 02:32:05 -0400 Subject: [PATCH] No category and no search string returns everything within the radius Change-Id: Ic3348306053a5fb0a9f0a74fd586dbd07dcf429d --- src/mapzen_plugin.c | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/src/mapzen_plugin.c b/src/mapzen_plugin.c index 713b9e5..6276e9c 100644 --- a/src/mapzen_plugin.c +++ b/src/mapzen_plugin.c @@ -1470,20 +1470,17 @@ EXPORT_API int maps_plugin_search_place(const maps_coordinates_h position, int d maps_place_category_destroy(category); } - if (categoryId) - place_req->categories = g_strdup_printf("%s", categoryId); + if (categoryId) { + if (strlen(categoryId) == 0) { + place_req->categories = NULL; + } else { + place_req->categories = g_strdup_printf("%s", categoryId); + } + } if (searchKeyword) place_req->search_string = g_strdup_printf("%s", searchKeyword); - if (!searchKeyword && !categoryId) { - g_free(calldata_place); - calldata_place = NULL; - g_free(place_req); - place_req = NULL; - return MAPS_ERROR_INVALID_PARAMETER; - } - if (searchKeyword) { g_free(searchKeyword); searchKeyword = NULL; @@ -1660,20 +1657,17 @@ EXPORT_API int maps_plugin_search_place_list(const maps_area_h boundary, const m maps_place_category_destroy(category); } - if (categoryId) - place_req->categories = g_strdup_printf("%s", categoryId); + if (categoryId) { + if (strlen(categoryId) == 0) { + place_req->categories = NULL; + } else { + place_req->categories = g_strdup_printf("%s", categoryId); + } + } if (searchKeyword) place_req->search_string = g_strdup_printf("%s", searchKeyword); - if (!searchKeyword && !categoryId) { - g_free(calldata_place); - calldata_place = NULL; - g_free(place_req); - place_req = NULL; - return MAPS_ERROR_INVALID_PARAMETER; - } - if (searchKeyword) { g_free(searchKeyword); searchKeyword = NULL; -- 2.7.4