llava-cli : don't crash if --image flag is invalid

This change fixes an issue where supplying `--image missing-file` would
result in a segfault due to a null pointer being dereferenced. This can
result in distracting info being printed if robust crash analysis tools
are being used.
This commit is contained in:
Justine Tunney 2024-01-09 03:14:30 -08:00
parent 128de3585b
commit 0344b6a692
No known key found for this signature in database
GPG key ID: BE714B4575D6E328

View file

@ -243,6 +243,9 @@ int main(int argc, char ** argv) {
}
auto image_embed = load_image(ctx_llava, &params);
if (!image_embed) {
return 1;
}
// process the prompt
process_prompt(ctx_llava, image_embed, &params, params.prompt);