diff --git a/dom/system/gonk/GonkGPSGeolocationProvider.cpp b/dom/system/gonk/GonkGPSGeolocationProvider.cpp index f8a96e543da..c3b99a63cd9 100644 --- a/dom/system/gonk/GonkGPSGeolocationProvider.cpp +++ b/dom/system/gonk/GonkGPSGeolocationProvider.cpp @@ -449,8 +449,23 @@ GonkGPSGeolocationProvider::SetReferenceLocation() nsCOMPtr iccInfo; rilCtx->GetIccInfo(getter_AddRefs(iccInfo)); if (iccInfo) { - iccInfo->GetMcc(&location.u.cellID.mcc); - iccInfo->GetMnc(&location.u.cellID.mnc); + nsresult result; + nsAutoString mcc, mnc; + + iccInfo->GetMcc(mcc); + iccInfo->GetMnc(mnc); + + location.u.cellID.mcc = mcc.ToInteger(&result, 10); + if (result != NS_OK) { + NS_WARNING("Cannot parse mcc to integer"); + location.u.cellID.mcc = 0; + } + + location.u.cellID.mnc = mnc.ToInteger(&result, 10); + if (result != NS_OK) { + NS_WARNING("Cannot parse mnc to integer"); + location.u.cellID.mnc = 0; + } } nsCOMPtr voice; rilCtx->GetVoice(getter_AddRefs(voice));