Huawei EM770W responses empty "+CPUC: \r\n". So return empty currency
and zero ppuval.
---
 drivers/atmodem/call-meter.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/atmodem/call-meter.c b/drivers/atmodem/call-meter.c
index 0553d78..74528ee 100644
--- a/drivers/atmodem/call-meter.c
+++ b/drivers/atmodem/call-meter.c
@@ -253,11 +253,19 @@ static void cpuc_query_cb(gboolean ok,
        }
 
        g_at_result_iter_next_string(&iter, &currency);
+
+       if (currency == NULL) {
+               memset(currency_buf, 0, sizeof(currency_buf));
+               ppuval = 0;
+               goto done;
+       }
+
        strncpy(currency_buf, currency, sizeof(currency_buf));
 
        g_at_result_iter_next_string(&iter, &ppu);
        ppuval = strtod(ppu, NULL);
 
+done:
        cb(&error, currency_buf, ppuval, cbd->data);
 }
 
-- 
1.6.3.3

_______________________________________________
ofono mailing list
[email protected]
http://lists.ofono.org/listinfo/ofono

Reply via email to