Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

fix(video): fix nil reference exception in playback metrics. Closes #3984

Gabe Kangasb304a25435a5
diff --git a/webserver/handlers/playbackMetrics.go b/webserver/handlers/playbackMetrics.go
index 1bb7954bd2..3b40034657 100644
--- a/webserver/handlers/playbackMetrics.go
+++ b/webserver/handlers/playbackMetrics.go
@@ -30,15 +30,15 @@ func ReportPlaybackMetrics(w http.ResponseWriter, r *http.Request) {
clientID := utils.GenerateClientIDFromRequest(r)
metrics.RegisterPlaybackErrorCount(clientID, *request.Errors)
- if *request.Bandwidth != 0.0 {
+ if request.Bandwidth != nil && *request.Bandwidth != 0.0 {
metrics.RegisterPlayerBandwidth(clientID, *request.Bandwidth)
}
- if *request.Latency != 0.0 {
+ if request.Latency != nil && *request.Latency != 0.0 {
metrics.RegisterPlayerLatency(clientID, *request.Latency)
}
- if *request.DownloadDuration != 0.0 {
+ if request.DownloadDuration != nil && *request.DownloadDuration != 0.0 {
metrics.RegisterPlayerSegmentDownloadDuration(clientID, *request.DownloadDuration)
}