From b70c78fbfcb858c685dd299e5eacc2849b081175 Mon Sep 17 00:00:00 2001 From: Stefano Russello Date: Thu, 13 Jul 2023 13:20:07 +0200 Subject: [PATCH] SMD-2259 Fixed crashlytics crash - Fixed a crash in case time is not convertible to string --- Changelog.md | 2 ++ Source/StreamSDKPlayKit/Player/Analytics/HeatMap.swift | 4 +++- .../Player/Controls/AMGPlayKitStandardControl.swift | 1 + StreamAMGSDK.podspec | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Changelog.md b/Changelog.md index 49c278f..ff2275e 100644 --- a/Changelog.md +++ b/Changelog.md @@ -3,6 +3,8 @@ Change Log: All notable changes to this project will be documented in this section. +### 1.2.5 - Fixed crashlytics crash + ### 1.2.4 - Fixed StreamPlay FixtureID field types ### 1.2.3 diff --git a/Source/StreamSDKPlayKit/Player/Analytics/HeatMap.swift b/Source/StreamSDKPlayKit/Player/Analytics/HeatMap.swift index 31d26f5..05bab37 100644 --- a/Source/StreamSDKPlayKit/Player/Analytics/HeatMap.swift +++ b/Source/StreamSDKPlayKit/Player/Analytics/HeatMap.swift @@ -56,7 +56,9 @@ class HeatMap { if (currentTime < sectionStart || currentTime > sectionEnd) { markNewSection(currentTime: currentTime) } else if currentSectionCount > 5 { - heatMap[currentSection] = 1 + if currentSection < heatMap.count { + heatMap[currentSection] = 1 + } } else { currentSectionCount += 1 } diff --git a/Source/StreamSDKPlayKit/Player/Controls/AMGPlayKitStandardControl.swift b/Source/StreamSDKPlayKit/Player/Controls/AMGPlayKitStandardControl.swift index bcea883..92b9c08 100644 --- a/Source/StreamSDKPlayKit/Player/Controls/AMGPlayKitStandardControl.swift +++ b/Source/StreamSDKPlayKit/Player/Controls/AMGPlayKitStandardControl.swift @@ -601,6 +601,7 @@ class AMGPlayKitStandardControl: UIView, AMGControlDelegate { if !time.isFinite || time.isNaN { self.errorListener?.onError(error: PlaykitError(entryID: nil, errorParameter: "\(time)", exception: "Failed to convert time to String")) + return "" } var formattedTimeLeft = formatter.string(from: time)! let formattedSplit = formattedTimeLeft.split(separator: ":") diff --git a/StreamAMGSDK.podspec b/StreamAMGSDK.podspec index 80c2959..7671c71 100644 --- a/StreamAMGSDK.podspec +++ b/StreamAMGSDK.podspec @@ -2,7 +2,7 @@ Pod::Spec.new do |spec| spec.name = "StreamAMGSDK" - spec.version = "1.2.4" + spec.version = "1.2.5" spec.summary = "Stream AMG SDK" spec.swift_versions = "5"