Skip to content

Commit 9c7cb44

Browse files
committed
fix: avoid segfault for pix2pix models with no reference images
1 parent fce6afc commit 9c7cb44

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
@@ -2322,6 +2322,10 @@ sd_image_t* generate_image(sd_ctx_t* sd_ctx, const sd_img_gen_params_t* sd_img_g
23222322
if (sd_img_gen_params->ref_images_count > 0) {
23232323
LOG_INFO("EDIT mode");
23242324
}
2325+
else if (sd_ctx->sd->version == VERSION_SD1_PIX2PIX || sd_ctx->sd->version == VERSION_SDXL_PIX2PIX) {
2326+
LOG_ERROR("This model needs at least one reference image");
2327+
return NULL;
2328+
}
23252329

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

0 commit comments

Comments
 (0)