Added NULL check before function call

Added NULL check before calling nmea call back
function to prevent segmentation fault in case
no nmea call back is registered.

Change-Id: If2371f4522e12312630043c3953405f583829068
CRs-fixed: 578444
This commit is contained in:
Ashwin Kumar 2013-11-20 14:12:57 +05:30
parent 3e5e65938d
commit 9d9c284fbf
2 changed files with 5 additions and 2 deletions

View file

@ -857,6 +857,8 @@ void LocEngReportNmea::proc() const {
gettimeofday(&tv, (struct timezone *) NULL);
int64_t now = tv.tv_sec * 1000LL + tv.tv_usec / 1000;
CALLBACK_LOG_CALLFLOW("nmea_cb", %d, mLen);
if (locEng->nmea_cb != NULL)
locEng->nmea_cb(now, mNmea, mLen);
}
inline void LocEngReportNmea::locallog() const {

View file

@ -60,6 +60,7 @@ void loc_eng_nmea_send(char *pNmea, int length, loc_eng_data_s_type *loc_eng_dat
gettimeofday(&tv, (struct timezone *) NULL);
int64_t now = tv.tv_sec * 1000LL + tv.tv_usec / 1000;
CALLBACK_LOG_CALLFLOW("nmea_cb", %p, pNmea);
if (loc_eng_data_p->nmea_cb != NULL)
loc_eng_data_p->nmea_cb(now, pNmea, length);
LOC_LOGD("NMEA <%s", pNmea);
}