From 7113efcf716b5cce94869a29eff37aee0be10808 Mon Sep 17 00:00:00 2001 From: Will Hawkins Date: Thu, 5 May 2022 20:52:14 -0400 Subject: [Bugfix] Null pointer dereference when debugging disabled When there is no debugging enabled, there was a null pointer dereference as a result of invoking `saturate` with a null pointer to a `debug.Debugging` structure. --- networkQuality.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'networkQuality.go') diff --git a/networkQuality.go b/networkQuality.go index b5f9743..6b80a7e 100644 --- a/networkQuality.go +++ b/networkQuality.go @@ -516,12 +516,8 @@ func main() { } } - var downloadDebugging *debug.DebugWithPrefix = nil - var uploadDebugging *debug.DebugWithPrefix = nil - if debug.IsDebug(debugLevel) { - downloadDebugging = &debug.DebugWithPrefix{Prefix: "download"} - uploadDebugging = &debug.DebugWithPrefix{Prefix: "upload"} - } + var downloadDebugging *debug.DebugWithPrefix = debug.NewDebugWithPrefix(debugLevel, "download") + var uploadDebugging *debug.DebugWithPrefix = debug.NewDebugWithPrefix(debugLevel, "upload") downloadSaturationChannel := saturate( saturationCtx, -- cgit v1.2.3