diff --git a/gpt4all-backend/llamamodel.cpp b/gpt4all-backend/llamamodel.cpp index e0389229..d2b25b8a 100644 --- a/gpt4all-backend/llamamodel.cpp +++ b/gpt4all-backend/llamamodel.cpp @@ -122,6 +122,8 @@ static gguf_context *load_gguf(const char *fname) { static int32_t get_arch_key_u32(std::string const &modelPath, std::string const &archKey) { auto * ctx = load_gguf(modelPath.c_str()); + if (!ctx) + return -1; auto arch = get_arch_name(ctx); int32_t value = -1;