Skip to content

Commit 6acbd02

Browse files
committed
fix: avoid segfault for pix2pix models with no reference images
1 parent d7f430c commit 6acbd02

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

stable-diffusion.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2303,6 +2303,10 @@ sd_image_t* generate_image(sd_ctx_t* sd_ctx, const sd_img_gen_params_t* sd_img_g
23032303
if (sd_img_gen_params->ref_images_count > 0) {
23042304
LOG_INFO("EDIT mode");
23052305
}
2306+
else if (sd_ctx->sd->version == VERSION_SD1_PIX2PIX || sd_ctx->sd->version == VERSION_SDXL_PIX2PIX) {
2307+
LOG_ERROR("This model needs at least one reference image");
2308+
return NULL;
2309+
}
23062310

23072311
std::vector<struct ggml_tensor*> ref_latents;
23082312
for (int i = 0; i < sd_img_gen_params->ref_images_count; i++) {

0 commit comments

Comments
 (0)