From d31430281a53e5d43b20ee8fa2c2999ef39862e4 Mon Sep 17 00:00:00 2001 From: Nick Cooke <36927374+ncooke3@users.noreply.github.com> Date: Mon, 13 May 2024 13:19:12 -0400 Subject: [PATCH] [NFC] Fix null pointer profiler warning (#125) --- CHANGELOG.md | 3 +++ GoogleDataTransport/GDTCORLibrary/GDTCORLogSourceMetrics.m | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c5cd3a..4b75224 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# Unreleased +- Fix null pointer warning from profiler. (#124) + # v9.4.1 (CocoaPods Only) - The v9.4.0 podspec did not include the intended dependency range for nanopb ([firebase-ios-sdk/#12477](https://github.com/firebase/firebase-ios-sdk/issues/12477)) diff --git a/GoogleDataTransport/GDTCORLibrary/GDTCORLogSourceMetrics.m b/GoogleDataTransport/GDTCORLibrary/GDTCORLogSourceMetrics.m index aaabb47..9910bf0 100644 --- a/GoogleDataTransport/GDTCORLibrary/GDTCORLogSourceMetrics.m +++ b/GoogleDataTransport/GDTCORLibrary/GDTCORLogSourceMetrics.m @@ -52,7 +52,7 @@ typedef NSDictionary GDTCORDroppedEventCounter; // If the dropped event counter for this event's mapping ID is `nil`, // an empty mutable counter is returned. NSMutableDictionary *eventCounter = - [NSMutableDictionary dictionaryWithDictionary:eventCounterByLogSource[event.mappingID]]; + [NSMutableDictionary dictionaryWithDictionary:eventCounterByLogSource[event.mappingID] ?: @{}]; // Increment the log source metrics for the given reason. NSInteger currentEventCountForReason = [eventCounter[@(reason)] integerValue];