From c7368e5daa80828239cfa9a83c1a15138d6506c2 Mon Sep 17 00:00:00 2001 From: arjunshajitech Date: Mon, 24 Aug 2026 14:58:19 +0530 Subject: [PATCH] Validate minimum samples for slope calculation --- gcc/trendline_estimator.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gcc/trendline_estimator.go b/gcc/trendline_estimator.go index a433f54..c43994e 100644 --- a/gcc/trendline_estimator.go +++ b/gcc/trendline_estimator.go @@ -79,6 +79,10 @@ func (e *trendlineEstimator) update(arrivalTime time.Time, interGroupDelay time. } func fitSlope(packets []packetDelay) (float64, bool) { + if len(packets) < 2 { + return 0, false + } + sumX := 0.0 sumY := 0.0