Skip to content

Commit 91d6cc8

Browse files
committed
Throw more instructive error if setViewDraggable is called with null args
1 parent 23e5ea2 commit 91d6cc8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

library/src/main/java/com/jmedeisis/draglinearlayout/DragLinearLayout.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,11 @@ public void addDragView(View child, View dragHandle, int index) {
264264
* Makes the child a candidate for dragging. Must be an existing child of this layout.
265265
*/
266266
public void setViewDraggable(View child, View dragHandle) {
267+
if (null == child || null == dragHandle) {
268+
throw new IllegalArgumentException(
269+
"Draggable children and their drag handles must not be null.");
270+
}
271+
267272
if (this == child.getParent()) {
268273
dragHandle.setOnTouchListener(new DragHandleOnTouchListener(child));
269274
draggableChildren.put(indexOfChild(child), new DraggableChild());

0 commit comments

Comments
 (0)