mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-30 11:11:53 +00:00
[backport 1.25] Add bounds checking for clipspace indices to prevent paste errors (core/1.25 backport) (#4904)
This commit is contained in:
@@ -3976,13 +3976,19 @@ class UIManager {
|
|||||||
const mainImageFilename =
|
const mainImageFilename =
|
||||||
new URL(mainImageUrl).searchParams.get('filename') ?? undefined
|
new URL(mainImageUrl).searchParams.get('filename') ?? undefined
|
||||||
|
|
||||||
const combinedImageFilename =
|
let combinedImageFilename: string | null | undefined
|
||||||
|
if (
|
||||||
ComfyApp.clipspace?.combinedIndex !== undefined &&
|
ComfyApp.clipspace?.combinedIndex !== undefined &&
|
||||||
ComfyApp.clipspace?.imgs?.[ComfyApp.clipspace.combinedIndex]?.src
|
ComfyApp.clipspace?.imgs &&
|
||||||
? new URL(
|
ComfyApp.clipspace.combinedIndex < ComfyApp.clipspace.imgs.length &&
|
||||||
ComfyApp.clipspace.imgs[ComfyApp.clipspace.combinedIndex].src
|
ComfyApp.clipspace.imgs[ComfyApp.clipspace.combinedIndex]?.src
|
||||||
).searchParams.get('filename')
|
) {
|
||||||
: undefined
|
combinedImageFilename = new URL(
|
||||||
|
ComfyApp.clipspace.imgs[ComfyApp.clipspace.combinedIndex].src
|
||||||
|
).searchParams.get('filename')
|
||||||
|
} else {
|
||||||
|
combinedImageFilename = undefined
|
||||||
|
}
|
||||||
|
|
||||||
const imageLayerFilenames =
|
const imageLayerFilenames =
|
||||||
mainImageFilename !== undefined
|
mainImageFilename !== undefined
|
||||||
|
|||||||
@@ -385,8 +385,15 @@ export class ComfyApp {
|
|||||||
static pasteFromClipspace(node: LGraphNode) {
|
static pasteFromClipspace(node: LGraphNode) {
|
||||||
if (ComfyApp.clipspace) {
|
if (ComfyApp.clipspace) {
|
||||||
// image paste
|
// image paste
|
||||||
const combinedImgSrc =
|
let combinedImgSrc: string | undefined
|
||||||
ComfyApp.clipspace.imgs?.[ComfyApp.clipspace.combinedIndex].src
|
if (
|
||||||
|
ComfyApp.clipspace.combinedIndex !== undefined &&
|
||||||
|
ComfyApp.clipspace.imgs &&
|
||||||
|
ComfyApp.clipspace.combinedIndex < ComfyApp.clipspace.imgs.length
|
||||||
|
) {
|
||||||
|
combinedImgSrc =
|
||||||
|
ComfyApp.clipspace.imgs[ComfyApp.clipspace.combinedIndex].src
|
||||||
|
}
|
||||||
if (ComfyApp.clipspace.imgs && node.imgs) {
|
if (ComfyApp.clipspace.imgs && node.imgs) {
|
||||||
if (node.images && ComfyApp.clipspace.images) {
|
if (node.images && ComfyApp.clipspace.images) {
|
||||||
if (ComfyApp.clipspace['img_paste_mode'] == 'selected') {
|
if (ComfyApp.clipspace['img_paste_mode'] == 'selected') {
|
||||||
|
|||||||
Reference in New Issue
Block a user