fix(ui): use empty string fallback if unable to parse prompts when creating style preset from existing image

This commit is contained in:
Mary Hipp 2024-08-22 13:19:20 -04:00 committed by psychedelicious
parent 83144f4fe3
commit da7dee44c6

View File

@ -86,8 +86,19 @@ export const useImageActions = (image_name?: string) => {
const createAsPreset = useCallback(async () => {
if (image_name && metadata && imageDTO) {
const positivePrompt = await handlers.positivePrompt.parse(metadata);
const negativePrompt = await handlers.negativePrompt.parse(metadata);
let positivePrompt;
let negativePrompt;
try {
positivePrompt = await handlers.positivePrompt.parse(metadata);
} catch (error) {
positivePrompt = ""
}
try {
negativePrompt = await handlers.negativePrompt.parse(metadata);
} catch (error) {
negativePrompt = ""
}
$stylePresetModalState.set({
prefilledFormData: {