From 587a37b2e20da2c4c494401e4a77c7900ecd529e Mon Sep 17 00:00:00 2001 From: stduhpf Date: Sat, 18 Jan 2025 06:13:34 +0100 Subject: [PATCH] fix: avoid sd2((non inpaint) crash on v-pred check (#537) --- stable-diffusion.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stable-diffusion.cpp b/stable-diffusion.cpp index e2daf57..b5424ad 100644 --- a/stable-diffusion.cpp +++ b/stable-diffusion.cpp @@ -606,7 +606,9 @@ public: ggml_set_f32(timesteps, 999); struct ggml_tensor* concat = is_inpaint ? ggml_new_tensor_4d(work_ctx, GGML_TYPE_F32, 8, 8, 5, 1) : NULL; - ggml_set_f32(concat, 0); + if (concat != NULL) { + ggml_set_f32(concat, 0); + } int64_t t0 = ggml_time_ms(); struct ggml_tensor* out = ggml_dup_tensor(work_ctx, x_t);