Skip to content

Add null check before saving image to prevent panic#98

Merged
newfla merged 1 commit intonewfla:mainfrom
zen-en-tonal:fix/panic_on_oom
Mar 25, 2026
Merged

Add null check before saving image to prevent panic#98
newfla merged 1 commit intonewfla:mainfrom
zen-en-tonal:fix/panic_on_oom

Conversation

@zen-en-tonal
Copy link
Copy Markdown
Contributor

This pull request adds an error check to handle out-of-memory (OOM) and other image generation errors in the gen_img_maybe_progress function. The function now returns an error if the generated image data is null, preventing further processing or saving of invalid images.

Error handling improvements:

  • Added a check to return a DiffusionError::Forward if img.data is null, which can occur on OOM or other generation errors, ensuring invalid images are not saved or processed further in gen_img_maybe_progress (src/api.rs).

@newfla
Copy link
Copy Markdown
Owner

newfla commented Mar 25, 2026

LGTM!

Thank you for your contribution.

@newfla newfla merged commit d96913e into newfla:main Mar 25, 2026
20 checks passed
@zen-en-tonal zen-en-tonal deleted the fix/panic_on_oom branch March 25, 2026 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants