Skip to content

Commit 36e5a08

Browse files
authored
llava-cli : don't crash if --image flag is invalid (#4835)
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.
1 parent 4dccb38 commit 36e5a08

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

examples/llava/llava-cli.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,9 @@ int main(int argc, char ** argv) {
243243
}
244244

245245
auto image_embed = load_image(ctx_llava, &params);
246+
if (!image_embed) {
247+
return 1;
248+
}
246249

247250
// process the prompt
248251
process_prompt(ctx_llava, image_embed, &params, params.prompt);

0 commit comments

Comments
 (0)