Explorar o código

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.
Justine Tunney %!s(int64=2) %!d(string=hai) anos
pai
achega
36e5a08b20
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  1. 3 0
      examples/llava/llava-cli.cpp

+ 3 - 0
examples/llava/llava-cli.cpp

@@ -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);