Handle empty paste array (#202038)

This commit is contained in:
Logan Ramos 2024-01-08 12:48:16 -07:00 committed by GitHub
parent fbb656b4d2
commit e1f8dddce9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1097,7 +1097,7 @@ export const pasteFileHandler = async (accessor: ServicesAccessor, fileList?: Fi
const toPaste = await getFilesToPaste(fileList, clipboardService);
if (confirmPasteNative) {
if (confirmPasteNative && toPaste?.length >= 1) {
const message = toPaste.length > 1 ?
nls.localize('confirmMultiPasteNative', "Are you sure you want to paste the following {0} items?", toPaste.length) :
nls.localize('confirmPasteNative', "Are you sure you want to paste '{0}'?", basename(toPaste[0].fsPath));