Skip to content

Commit b50c44b

Browse files
hipsterusernamepsychedelicious
authored andcommitted
handle potential for invalid list item
1 parent b4ce0e0 commit b50c44b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

invokeai/frontend/web/src/features/parameters/components/Core/ParamPositivePrompt.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,10 @@ export const ParamPositivePrompt = memo(() => {
136136
}
137137
const clamped = Math.max(0, Math.min(idx, list.length - 1));
138138
browsingIndexRef.current = clamped;
139-
dispatch(positivePromptChanged(list[clamped]));
139+
const historyItem = list[clamped];
140+
if (historyItem !== undefined) {
141+
dispatch(positivePromptChanged(historyItem));
142+
}
140143
requestAnimationFrame(() => {
141144
const el = textareaRef.current;
142145
if (!el) {

0 commit comments

Comments
 (0)