add safety measures to add function of GridLogic

This commit is contained in:
chfhtw
2026-04-21 13:49:39 +02:00
parent dbf945dfe5
commit 38ea481177
+2
View File
@@ -44,6 +44,8 @@ class GridLogic {
return freeSlots;
}
add(item, prefer) {
if (!item.frame)
item.frame = this.getItemFrame(item);
let occupiers = this.getItemsInFrame(item.frame);
if (!occupiers.length) {
item.frame.forEach(f => this.grid[f] = item.index);