diff --git a/js/activity.js b/js/activity.js index 2622ecff2c..1c0de1de6b 100644 --- a/js/activity.js +++ b/js/activity.js @@ -3222,7 +3222,19 @@ class Activity { * Repositions blocks about trash area */ const restoreTrash = (activity) => { + if (!activity.blocks || !activity.blocks.trashStacks || activity.blocks.trashStacks.length === 0) { + activity.textMsg( + _("Nothing in the trash to restore."), + 3000 + ); + return; + } activity._restoreTrash(); + activity.textMsg( + _("Item restored from the trash."), + 3000 + ); + if (docById("helpfulWheelDiv").style.display !== "none") { docById("helpfulWheelDiv").style.display = "none"; activity.__tick(); @@ -7062,4 +7074,4 @@ define(MYDEFINES, (compatibility) =>{ activity.setupDependencies(); activity.doContextMenus(); activity.doPluginsAndPaletteCols(); -}); +}); \ No newline at end of file