From 9714e38dd098a466d613edd87f3576ddd5c246f4 Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Mon, 8 Sep 2025 09:53:59 -0700 Subject: [PATCH] fix: nil pointer dereference if cache is nil (#12215) --- runner/ollamarunner/cache.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/runner/ollamarunner/cache.go b/runner/ollamarunner/cache.go index 955ef9b3..1d1ca518 100644 --- a/runner/ollamarunner/cache.go +++ b/runner/ollamarunner/cache.go @@ -70,11 +70,9 @@ func kvCacheTypeFromStr(s string) ml.DType { } func (c *InputCache) Close() { - if c == nil { - return + if c != nil && c.cache != nil { + c.cache.Close() } - - c.cache.Close() } // Locking: Operations on InputCacheSlot (including finding one