Skip to content

Commit 874fd89

Browse files
committed
server: add null check for context to prevent segfault on init failure
1 parent 4eac5b4 commit 874fd89

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

tools/server/server-context.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,11 @@ struct server_context_impl {
759759
return false;
760760
}
761761

762+
if (ctx == nullptr) {
763+
SRV_ERR("failed to create context for model, '%s'\n", params_base.model.path.c_str());
764+
return false;
765+
}
766+
762767
vocab = llama_model_get_vocab(model);
763768

764769
n_ctx = llama_n_ctx(ctx);

0 commit comments

Comments
 (0)