mirror of
https://github.com/nomic-ai/gpt4all
synced 2024-11-02 09:40:42 +00:00
Fix crasher with an empty string for prompt template.
This commit is contained in:
parent
5fe685427a
commit
b2cd3bdb3f
@ -423,6 +423,9 @@ std::string trim_whitespace(const std::string& input) {
|
||||
return !std::isspace(c);
|
||||
});
|
||||
|
||||
if (first_non_whitespace == input.end())
|
||||
return std::string();
|
||||
|
||||
auto last_non_whitespace = std::find_if(input.rbegin(), input.rend(), [](unsigned char c) {
|
||||
return !std::isspace(c);
|
||||
}).base();
|
||||
|
Loading…
Reference in New Issue
Block a user