diff options
| author | Will Hawkins <[email protected]> | 2022-05-05 20:52:14 -0400 |
|---|---|---|
| committer | Will Hawkins <[email protected]> | 2022-05-05 20:52:14 -0400 |
| commit | 7113efcf716b5cce94869a29eff37aee0be10808 (patch) | |
| tree | 696906e50dd0e3f3a38ae69ae3d4cd52adbfbe61 | |
| parent | 2a9feb82b55481308c0f6aa9d813e9021b0333ef (diff) | |
[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.
| -rw-r--r-- | networkQuality.go | 8 |
1 files changed, 2 insertions, 6 deletions
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, |
