diff --git a/gps/libloc_api_50001/loc.cpp b/gps/libloc_api_50001/loc.cpp index 9e08677..f27eadd 100644 --- a/gps/libloc_api_50001/loc.cpp +++ b/gps/libloc_api_50001/loc.cpp @@ -521,7 +521,7 @@ const GpsGeofencingInterface* get_geofence_interface(void) } dlerror(); /* Clear any existing error */ get_gps_geofence_interface = (get_gps_geofence_interface_function)dlsym(handle, "gps_geofence_get_interface"); - if ((error = dlerror()) != NULL) { + if ((error = dlerror()) != NULL && NULL != get_gps_geofence_interface) { LOC_LOGE ("%s, dlsym for get_gps_geofence_interface failed, error = %s\n", __func__, error); goto exit; } diff --git a/gps/libloc_api_50001/loc_eng_nmea.cpp b/gps/libloc_api_50001/loc_eng_nmea.cpp index 842eda1..4c6b9a3 100644 --- a/gps/libloc_api_50001/loc_eng_nmea.cpp +++ b/gps/libloc_api_50001/loc_eng_nmea.cpp @@ -119,14 +119,17 @@ void loc_eng_nmea_generate_pos(loc_eng_data_s_type *loc_eng_data_p, unsigned char generate_nmea) { ENTRY_LOG(); + time_t utcTime(location.gpsLocation.timestamp/1000); + tm * pTm = gmtime(&utcTime); + if (NULL == pTm) { + LOC_LOGE("gmtime failed"); + return; + } char sentence[NMEA_SENTENCE_MAX_LENGTH] = {0}; char* pMarker = sentence; int lengthRemaining = sizeof(sentence); int length = 0; - - time_t utcTime(location.gpsLocation.timestamp/1000); - tm * pTm = gmtime(&utcTime); int utcYear = pTm->tm_year % 100; // 2 digit year int utcMonth = pTm->tm_mon + 1; // tm_mon starts at zero int utcDay = pTm->tm_mday;