Skip to content

Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.

fix: nil pointer dereference if cache is nil (#12215)

Michael Yang9714e38dd098
diff --git a/runner/ollamarunner/cache.go b/runner/ollamarunner/cache.go
index 955ef9b3d..1d1ca5180 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