Skip to content

Commit ad3b82e

Browse files
committed
Fix for when getLayoutItem return null object
1 parent f3c28af commit ad3b82e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/GridLayout.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,10 @@
220220
}
221221
//console.log(eventName + " id=" + id + ", x=" + x + ", y=" + y);
222222
var l = getLayoutItem(this.layout, id);
223+
//GetLayoutItem sometimes returns null object
224+
if (l == null){
225+
l = {x:0, y:0}
226+
}
223227
l.x = x;
224228
l.y = y;
225229
// Move the element to the dragged ___location.
@@ -244,6 +248,10 @@
244248
this.isDragging = false;
245249
}
246250
var l = getLayoutItem(this.layout, id);
251+
//GetLayoutItem sometimes return null object
252+
if (l == null){
253+
l = {h:0, w:0}
254+
}
247255
l.h = h;
248256
l.w = w;
249257
compact(this.layout, this.verticalCompact);

0 commit comments

Comments
 (0)