Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6167f428 authored by Stephen Bird's avatar Stephen Bird
Browse files

NPE: check that cn is null and return

We don't want to store null values in our sharedprefs,
and we dont want to crash.

Ticket: CD-569
Change-Id: I647bb9bb8861ed4205c11940b2efcda884e49a21
parent 416100f0
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -320,6 +320,10 @@ public class InCallMetricsHelper {
     */
     */
    public static void increaseCountOfMetric(ComponentName cn, Events event, Categories cat,
    public static void increaseCountOfMetric(ComponentName cn, Events event, Categories cat,
                                             Parameters param) {
                                             Parameters param) {
        if (cn == null) {
            // this is only null if we do not have a sim card.
            return;
        }
        HashMap<Parameters, Object> metricsData = getStoredEventParams(cn, cat, event);
        HashMap<Parameters, Object> metricsData = getStoredEventParams(cn, cat, event);
        metricsData.put(param, increaseCount(metricsData,param));
        metricsData.put(param, increaseCount(metricsData,param));
        storeEvent(cn, cat, event, metricsData);
        storeEvent(cn, cat, event, metricsData);