Shuta Nakamae / nRF51822

Fork of nRF51822 by Nordic Semiconductor

Revision:
196:70f1b8354d57
Parent:
195:061ed80ffbcf
Child:
197:de757ae3358b
--- a/btle/btle_gattc.cpp	Fri Jun 19 15:55:15 2015 +0100
+++ b/btle/btle_gattc.cpp	Fri Jun 19 15:55:16 2015 +0100
@@ -129,8 +129,10 @@
 
         discoveryStatus.currSrvInd++;
     }
-    printf("services discover returned %u\r\n",
-        sd_ble_gattc_primary_services_discover(p_ble_evt->evt.gattc_evt.conn_handle,
-                                               p_ble_evt->evt.gattc_evt.params.prim_srvc_disc_rsp.services[discoveryStatus.currSrvInd -1].handle_range.end_handle,
-                                               NULL));
+    if (discoveryStatus.srvCount > 0) {
+        printf("services discover returned %u\r\n",
+            sd_ble_gattc_primary_services_discover(p_ble_evt->evt.gattc_evt.conn_handle,
+                                                   p_ble_evt->evt.gattc_evt.params.prim_srvc_disc_rsp.services[discoveryStatus.currSrvInd -1].handle_range.end_handle,
+                                                   NULL));
+    }
 }
\ No newline at end of file