mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 07:08:55 +02:00
chore(react/collections/board): prevent crash if dragging wrong JSON
This commit is contained in:
parent
679abc6e3e
commit
87648f340b
@ -215,7 +215,13 @@ function useDragging({ column, columnIndex, columnItems, isEditing }: DragContex
|
|||||||
|
|
||||||
const data = e.dataTransfer?.getData("text");
|
const data = e.dataTransfer?.getData("text");
|
||||||
if (!data) return;
|
if (!data) return;
|
||||||
const draggedCard = JSON.parse(data) as CardDragData | DragData[];
|
|
||||||
|
let draggedCard: CardDragData | DragData[];
|
||||||
|
try {
|
||||||
|
draggedCard = JSON.parse(data);
|
||||||
|
} catch (e) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (Array.isArray(draggedCard)) {
|
if (Array.isArray(draggedCard)) {
|
||||||
// From note tree.
|
// From note tree.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user