Skip to content

Commit 29086b3

Browse files
committed
check nonetype in sampler and scheduler
1 parent f3696ce commit 29086b3

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/server.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,13 +293,13 @@ crow::response Server::generateImage(const crow::json::rvalue& json_body, bool i
293293
params.batch_count = json_body.has("batch_size") ? json_body["batch_size"].i() : 1;
294294

295295
// Sampler and scheduler parameters
296-
if (json_body.has("sampler_name")) {
296+
if (json_body.has("sampler_name") && json_body["sampler_name"].t() == crow::json::type::String) {
297297
std::string sampler_str = json_body["sampler_name"].s();
298298
// Convert from webui-style sampler name to sd.cpp name
299299
sampler_str = convert_webui_sampler_name(sampler_str);
300300
params.sampler = str_to_sample_method(sampler_str.c_str());
301301
}
302-
if (json_body.has("scheduler")) {
302+
if (json_body.has("scheduler") && json_body["scheduler"].t() == crow::json::type::String) {
303303
std::string scheduler_str = json_body["scheduler"].s();
304304
// Convert from webui-style scheduler name to sd.cpp name
305305
scheduler_str = convert_webui_scheduler_name(scheduler_str);

0 commit comments

Comments
 (0)