From 40b740ad05c531b9d57aca6698c3ed553a9e784c Mon Sep 17 00:00:00 2001 From: fairydreaming <166155368+fairydreaming@users.noreply.github.com> Date: Tue, 21 Jul 2026 17:47:17 +0200 Subject: [PATCH] server : properly handle null llama_context (#25868) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Stanisław Szymczyk --- tools/server/server-context.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/server/server-context.cpp b/tools/server/server-context.cpp index 715477e2e..744593c76 100644 --- a/tools/server/server-context.cpp +++ b/tools/server/server-context.cpp @@ -1152,6 +1152,11 @@ private: return false; } + if (ctx_tgt == nullptr) { + SRV_ERR("failed to create_context with model '%s'\n", params_base.model.path.c_str()); + return false; + } + vocab = llama_model_get_vocab(model_tgt); n_ctx = llama_n_ctx(ctx_tgt);