No category and no search string returns everything within the radius 28/88928/1
authorVarun <tallytalwar@gmail.com>
Wed, 21 Sep 2016 06:32:05 +0000 (02:32 -0400)
committerVarun <tallytalwar@gmail.com>
Wed, 21 Sep 2016 06:32:05 +0000 (02:32 -0400)
Change-Id: Ic3348306053a5fb0a9f0a74fd586dbd07dcf429d

src/mapzen_plugin.c

index 713b9e5..6276e9c 100644 (file)
@@ -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;