diff options
author | Justine Tunney <jtunney@gmail.com> | 2024-01-09 09:59:14 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-09 19:59:14 +0200 |
commit | 36e5a08b203542dca53cca4eaf172c5dc4bbc991 (patch) | |
tree | a77d4c6080584ccf0409f184a55f28743004190d /examples/llava/llava-cli.cpp | |
parent | 4dccb38d9abab7f9f2d1f9a6977df4185d490132 (diff) |
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.
Diffstat (limited to 'examples/llava/llava-cli.cpp')
-rw-r--r-- | examples/llava/llava-cli.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/examples/llava/llava-cli.cpp b/examples/llava/llava-cli.cpp index 502b788b..d94795fe 100644 --- a/examples/llava/llava-cli.cpp +++ b/examples/llava/llava-cli.cpp @@ -243,6 +243,9 @@ int main(int argc, char ** argv) { } auto image_embed = load_image(ctx_llava, ¶ms); + if (!image_embed) { + return 1; + } // process the prompt process_prompt(ctx_llava, image_embed, ¶ms, params.prompt); |