-
Notifications
You must be signed in to change notification settings - Fork 12.2k
mtmd-cli : fix out_of_range when input image path is empty #13244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
examples/llava/mtmd-cli.cpp
Outdated
@@ -308,7 +308,7 @@ int main(int argc, char ** argv) { | |||
} | |||
g_is_generating = true; | |||
if (line.find("/image") == 0) { | |||
std::string image = line.substr(7); | |||
std::string image = (line.size()>=7) ? line.substr(7) : ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm this logic looks a bit hacky, I will replace it with something cleaner
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, please. Thanks for checking out.
Co-authored-by: Sigbjørn Skjæret <[email protected]>
@CISC what I want to do is to load the image right away if possible, will push a commit for it |
The CLI will try to load image right away, so it can now detect if the image is not exist:
|
Co-authored-by: Sigbjørn Skjæret <[email protected]>
Taking substring for the input case

"/image"
results in out_of_range exception.
This PR adds a check so that doesn't happen. This maintains the continuation of the loop.